I have written a RabbitMQ consumer by implementing the MessageListener interface and setting up a SimpleMessageListenerContainer. Its working well when I test it manually. N
There are several approaches, the easiest being to wrap your listener and pass in a CountDownLatch
which is counted down by the listener and the main test thread uses
assertTrue(latch.await(TimeUnit.SECONDS));
You can also pass back the actual message received so you can verify it is as expected.
Also see the integration test cases in the framework itself.