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

    RabbitQueueProperties properties = new RabbitQueueProperties();
    properties.setConsumerCount(4);
    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.UP, health.getStatus());
    Assert.assertNotNull(health.getDetails().get("test"));
    Map<String, Object> details = (Map<String, Object>) health.getDetails().get("test");
    Assert.assertEquals(Status.UP.getCode(), details.get("status"));
    Assert.assertEquals(5883, details.get("currentMessageCount"));
    Assert.assertEquals(10000, details.get("maxMessageCount"));
    Assert.assertEquals(4, details.get("currentConsumerCount"));
    Assert.assertEquals(2, details.get("minConsumerCount"));
  }
  @SuppressWarnings({"unchecked", "boxing"})
  @Test
  public void testDoHealthCheckMultipleQueueChecksOneUpOneDown() throws Exception {
    Queue queue1 = generateQueue("test1");
    healthIndicator.addQueueCheck(queue1, 10000, 2);
    Queue queue2 = generateQueue("test2");
    healthIndicator.addQueueCheck(queue2, 40000, 5);

    RabbitQueueProperties properties1 = new RabbitQueueProperties();
    properties1.setConsumerCount(1);
    properties1.setMessageCount(15883);
    propertiesManager.request(queue1);
    PowerMock.expectLastCall().andReturn(properties1);

    RabbitQueueProperties properties2 = new RabbitQueueProperties();
    properties2.setConsumerCount(10);
    properties2.setMessageCount(5883);
    propertiesManager.request(queue2);
    PowerMock.expectLastCall().andReturn(properties2);

    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.assertEquals(2, health.getDetails().size());

    Assert.assertNotNull(health.getDetails().get("test1"));
    Map<String, Object> details1 = (Map<String, Object>) health.getDetails().get("test1");
    Assert.assertEquals(Status.DOWN.getCode(), details1.get("status"));
    Assert.assertEquals(15883, details1.get("currentMessageCount"));
    Assert.assertEquals(10000, details1.get("maxMessageCount"));
    Assert.assertEquals(1, details1.get("currentConsumerCount"));
    Assert.assertEquals(2, details1.get("minConsumerCount"));

    Assert.assertNotNull(health.getDetails().get("test2"));
    Map<String, Object> details2 = (Map<String, Object>) health.getDetails().get("test2");
    Assert.assertEquals(Status.UP.getCode(), details2.get("status"));
    Assert.assertEquals(5883, details2.get("currentMessageCount"));
    Assert.assertEquals(40000, details2.get("maxMessageCount"));
    Assert.assertEquals(10, details2.get("currentConsumerCount"));
    Assert.assertEquals(5, details2.get("minConsumerCount"));
  }