@Test
  public void testCount() throws Exception {
    int runs = 5;
    for (int i = 0; i < runs; i++) {
      MetricsFactory.getInstance().incrementCounter("count1");
      Counter counter = metricRegistry.getCounters().get("count1");
      Assert.assertEquals(i + 1, counter.getCount());
    }
  }
Unit test for new Metrics subsystem.
standalone-metastore/metastore-common/src/test/java/org/apache/hadoop/hive/common/metrics/metrics2/TestCodahaleMetrics.java