How to wait for @JMSListener annotated method to complete in JUnit
问题 So I am trying to get some integration testing of JMS processing, Spring (v4.1.6) based code. It's a very standard Spring setup with @JmsListener annotated method and a DefaultMessageListenerContainer with concurrency set to 1 and therefore allowing only 1 listening thread. Now, I leveraged ActiveMQ's embedded broker not to rely on any external jms broker for the tests to run anywhere anytime (I should work in marketing). So it all wires fine and then I have my JUnit test: @Test public void