title: how to mock spring amqp/rabbit in spring boot test
body: <p>How to mock spring rabbitmq/amqp so it will not fail during a Spring Boot Test while trying to auto create exchanges/queues?</p>
  
  <p>Given I have a simple <code>RabbitListener</code> that will cause the queue and exchange to be auto created like this:</p>
  
  <pre><code>@Component
  @RabbitListener(bindings = {
          @QueueBinding(
                  value = @Queue(value = "myqueue", autoDelete = "true"), 
                  exchange = @Exchange(value = "myexchange", autoDelete = "true", type = "direct"), 
                  key = "mykey")}
  )
  @RabbitListenerCondition
  public class EventHandler {
      @RabbitHandler
      public void onEvent(Event event) {
        ...
      }   
  }
  </code></pre>
  
  <p>During a simple Spring Boot Test, like this:</p>
  
  <pre><code>@ActiveProfiles("test")
  @RunWith(SpringRunner.class)
  @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = { Application.class })
  
      @Autowired
      private ApplicationContext applicationContext;
  
      @Test
      public void test() {
          assertNotNull(applicationContext);
      }
  
  }
  </code></pre>
  
  <p>it will fail with:</p>
  
  <pre><code>16:22:16.527 [SimpleAsyncTaskExecutor-1] ERROR o.s.a.r.l.SimpleMessageListenerContainer - Failed to check/redeclare auto-delete queue(s).
  org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused
      at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:62)
      at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:309)
  </code></pre>
  
  <p>In in this test I don't care about Rabbit/AMQP, so how can I mock the whole Rabbit/AMQP away?</p>