@Test
public void testCollectAllMetrics() {

  String queueName = "single";
  QueueMetrics.forQueue(ms, queueName, null, false, conf);
  MetricsSource queueSource = queueSource(ms, queueName);
  checkApps(queueSource, 0, 0, 0, 0, 0, 0, true);
  try {
    // do not collect all metrics
    checkApps(queueSource, 0, 0, 0, 0, 0, 0, false);
    Assert.fail();
  } catch (AssertionError e) {
    Assert.assertTrue(e.getMessage().contains(
      "Expected exactly one metric for name "));
  }
  // collect all metrics
  checkApps(queueSource, 0, 0, 0, 0, 0, 0, true);
}