@Override
  public long getCounter(String name, BaseSource source) {
    getMetrics(source);
    String cName = canonicalizeMetricName(name);
    assertNotNull("Should get counter " + cName + " but did not", counters.get(cName));
    return counters.get(cName).longValue();
  }
A helper class that will allow tests to get into hadoop2's metrics2 values.
hbase-hadoop-compat/src/test/java/org/apache/hadoop/hbase/test/MetricsAssertHelperImpl.java