@Test
public void testFairCallQueueMetrics() throws Exception {

  final String fcqMetrics = "ns.FairCallQueue";
  Schedulable p0 = mockCall("a", 0);
  Schedulable p1 = mockCall("b", 1);
  assertGauge("FairCallQueueSize_p0", 0, getMetrics(fcqMetrics));
  assertGauge("FairCallQueueSize_p1", 0, getMetrics(fcqMetrics));
  assertCounter("FairCallQueueOverflowedCalls_p0", 0L,
      getMetrics(fcqMetrics));
  assertCounter("FairCallQueueOverflowedCalls_p1", 0L,
      getMetrics(fcqMetrics));
  for (int i = 0; i < 5; i++) {
    fcq.add(p0);
    fcq.add(p1);
  }
  try {
    fcq.add(p1);
    fail("didn't overflow");
  } catch (IllegalStateException ise) {
    // Expected exception
  }
  assertGauge("FairCallQueueSize_p0", 5, getMetrics(fcqMetrics));
  assertGauge("FairCallQueueSize_p1", 5, getMetrics(fcqMetrics));
  assertCounter("FairCallQueueOverflowedCalls_p0", 0L,
      getMetrics(fcqMetrics));
  assertCounter("FairCallQueueOverflowedCalls_p1", 1L,
      getMetrics(fcqMetrics));
}