@SuppressWarnings({"unchecked", "boxing"})
  @Test
  public void testDoHealthCheckSingleQueueCheckConsumerDown() throws Exception {
    Queue queue = generateQueue("test");
    healthIndicator.addQueueCheck(queue, 10000, 2);

    RabbitQueueProperties properties = new RabbitQueueProperties();
    properties.setConsumerCount(1);
    properties.setMessageCount(5883);
    propertiesManager.request(queue);
    PowerMock.expectLastCall().andReturn(properties);

    PowerMock.replayAll();
    Builder builder = new Builder(Status.OUT_OF_SERVICE);
    healthIndicator.doHealthCheck(builder);
    PowerMock.verifyAll();

    Health health = builder.build();
    Assert.assertEquals(Status.DOWN, health.getStatus());
    Assert.assertNotNull(health.getDetails().get("test"));
    Map<String, Object> details = (Map<String, Object>) health.getDetails().get("test");
    Assert.assertEquals(Status.DOWN.getCode(), details.get("status"));
    Assert.assertEquals(5883, details.get("currentMessageCount"));
    Assert.assertEquals(10000, details.get("maxMessageCount"));
    Assert.assertEquals(1, details.get("currentConsumerCount"));
    Assert.assertEquals(2, details.get("minConsumerCount"));
  }
  @Test
  public void testDoHealthCheckSingleQueueCheckMetricException() throws Exception {
    Queue queue = generateQueue("test");
    healthIndicator.addQueueCheck(queue, 10000, 2);

    propertiesManager.request(queue);
    PowerMock.expectLastCall().andThrow(new RuntimeException());

    PowerMock.replayAll();
    Builder builder = new Builder(Status.OUT_OF_SERVICE);
    healthIndicator.doHealthCheck(builder);
    PowerMock.verifyAll();

    Health health = builder.build();
    Assert.assertEquals(Status.DOWN, health.getStatus());
    Assert.assertNull(health.getDetails().get("test"));
  }