简体   繁体   中英

Spock Test for ActiveMQ JMS listener in Spring Boot

I want to write spock test case for ActiveMQ JMS Listener using spring boot. Can somebody share any idea how to do it. I have followed the steps mentioned here https://spring.io/guides/gs/messaging-jms/ to create the listener. Below is the code for which I want to write unit test

@JmsListener( containerFactory = "myFactory", destination =  "some q")
    public void  processMesg( OrderRequest order ) {
        -------------------------
    }

You need to write a small JMS client (or use an existing one) that will be called from your Spock test and it will connect to you JMS queue.

Details on how to do do not fit in a single answer.

In general there is nothing specific about Spock and JMS. You need to have the capability to send custom JMS messages anyway, regardless of the test framework you will use in the end.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM