Reputation: 611
with the above consumer.class, when it runs in JUnit , it cannot receive message. but when running via main
method directly, it works well. The following is the invoking code:
and the JUnit version is 4.10.
So, would anyone give some point? Thanks a lot in advance!
Of course, when running the two invocation, the JMS server has enough messages waiting for consumption.
Upvotes: 1
Views: 1102
Reputation: 21015
since your testMq() method just registers a listener and doesn't block the test thread, the test case will just stop. try adding Thread.sleep(10000) after the listener is registered but before the test case ends...
Upvotes: 3