Results 1 to 2 of 2

Thread: Mock RabbitMQ for testing

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Location
    Germany
    Posts
    8

    Default 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. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,020

    Default

    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.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •