Announcement Announcement Module
Collapse
No announcement yet.
Mock RabbitMQ for testing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mock RabbitMQ for testing

    Hi

    is there already a way to mock a rabbitMQ environment to test code that uses rabbitTemplate and/or a MessageListener implementation? We use rabbitmq with great efficiency but for better code quality we want to add tests without the need of a rabbitMQ running in background.

    Cheers

    Kay

  • #2
    There are quite a few test cases in spring-rabbit that use Mockito to mock the connection factory, connections etc. For example, see CachingConnectionFactoryTests.java

    There are others (integration tests) that use the real rabbitMQ, but use a JUnit @Rule to detect if the broker is running, so they don't fail if it's not.

    Comment

    Working...
    X