@Test
public void testCollectCompassMetric() {

    MetricsCollector collector = MetricsCollectorFactory.createNew(TimeUnit.SECONDS.toSeconds(1),
            1.0 / TimeUnit.MILLISECONDS.toNanos(1), null);
    Assert.assertTrue(collector instanceof NormalMetricsCollector);
    // create a compass with 1 second bucket and a manual clock
    ManualClock clock = new ManualClock();
    Compass compass = new CompassImpl(ReservoirType.EXPONENTIALLY_DECAYING, clock, 10, 1, 10, 10);
    Compass.Context context = compass.time();
    context.markAddon("hit");
    clock.addSeconds(1);
    context.success();
    context.stop();
    collector.collect(MetricName.build("TEST"), compass, System.currentTimeMillis());
    List<MetricObject> metricObjects = collector.build();
    Assert.assertEquals(21, metricObjects.size());
    MetricObject found = null;
    for (MetricObject object: metricObjects) {
        if (object.getMetric().equals("TEST.hit.count")) {
            found = object;
        }
    }
    Assert.assertNotNull("Should have the .hit.count metric", found);
    // search for the instant count
    found = null;
    for (MetricObject object: metricObjects) {
        if (object.getMetric().equals("TEST.bucket_count")) {
            found = object;
        }
    }
    Assert.assertNotNull("Should have the .bucket_count metric", found);
    Assert.assertEquals(found.getMetricType(), MetricObject.MetricType.DELTA);
    // search for the instant count
    found = null;
    for (MetricObject object: metricObjects) {
        if (object.getMetric().equals("TEST.success_bucket_count")) {
            found = object;
        }
    }
    Assert.assertNotNull("Should have the .success_bucket_count metric", found);
    Assert.assertEquals(found.getMetricType(), MetricObject.MetricType.DELTA);
    // search for the instant count
    found = null;
    for (MetricObject object: metricObjects) {
        if (object.getMetric().equals("TEST.hit_bucket_count")) {
            found = object;
        }
    }
    Assert.assertNotNull("Should have the .hit_bucket_count metric", found);
    Assert.assertEquals(found.getMetricType(), MetricObject.MetricType.DELTA);
}