How to JUnit (preferably jupiter but JUnit 4 is ok) a javax.jms.messagelistener

25 views Asked by At

Trust me, I have googled and tried a lot of scenarios for a couple days. I have a javax.jms.messagelistener and I would like to JUnit test it. Last, I have tried with the JUnit rule EmbeddedActiveMQBroker but when I pass a messagelistener to the ActiveMQSession.createConsumer then I get:

javax.jms.IllegalStateException: Cannot synchronously receive a message when a MessageListener is set

The second step is I want to be able to use a javaee interceptor on the messagelistener and I would like to JUnit test this also.

If this must be done as an integration test (as I suspect) and working example with whatever open source broker or container will be acceptable.

0

There are 0 answers