I have integration test with docker using test containers. On container I run jms. In test I am putting message on queue.
How I can wait in test to make it populated on jms?
On local machine it works, but on jenkins it fails, so I have to add
Thread.sleep(3000);
but this is nasty. org.awaitility seems to be missed usage:
await().atMost(2, TimeUnit.SECONDS).until(() -> return true));
I just need to do a pause to make jms propagate (put on jms queue) and wait for listener to act, which is putting message to database. Then I have to call get rest endpoint to see it worked.
With topic it would be easier, because I would create test listener on topic. But it is queue, there can be on listener that will get message.
My solution is to use
org.awaitility
lib and replace asserts with return statement: