NO-JIRA fix flaky test QueueControlTest#testResetMessagesAdded

The occasional assertion error is prevented by using Wait.assertEquals
where Assert.assertEquals was used previously.

I did not observe the timing issue on all asserts (only on the first
two), but there is no harm in replacing them all.

    java.lang.AssertionError:
    Expected :2
    Actual   :1
This commit is contained in:
Jiri Danek 2018-08-07 17:10:00 +02:00 committed by Clebert Suconic
parent fbb622ae69
commit 23a30b6158
1 changed files with 4 additions and 4 deletions

View File

@ -2311,17 +2311,17 @@ public class QueueControlTest extends ManagementTestBase {
ClientProducer producer = session.createProducer(address);
producer.send(session.createMessage(durable));
Assert.assertEquals(1, getMessagesAdded(queueControl));
Wait.assertEquals(1, () -> getMessagesAdded(queueControl));
producer.send(session.createMessage(durable));
Assert.assertEquals(2, getMessagesAdded(queueControl));
Wait.assertEquals(2, () -> getMessagesAdded(queueControl));
consumeMessages(2, session, queue);
Assert.assertEquals(2, getMessagesAdded(queueControl));
Wait.assertEquals(2, () -> getMessagesAdded(queueControl));
queueControl.resetMessagesAdded();
Assert.assertEquals(0, getMessagesAdded(queueControl));
Wait.assertEquals(0, () -> getMessagesAdded(queueControl));
session.deleteQueue(queue);
}