@Test
public void testMountSubRegistry() throws Exception {

    MetricRegistry r1 = new MetricRegistry();
    r1.counter("counter1");
    int extant = ActivityMetrics.getMetricRegistry().getMetrics().size();
    ActivityMetrics.mountSubRegistry("aprefixhere.",r1);
    Map<String, Metric> metrics = ActivityMetrics.getMetricRegistry().getMetrics();
    assertThat(metrics).containsKey("aprefixhere.counter1");
    assertThat(metrics).hasSize(extant+1);
    r1.counter("counter2");
    metrics = ActivityMetrics.getMetricRegistry().getMetrics();
    assertThat(metrics).hasSize(extant+2);
    assertThat(metrics).containsKey("aprefixhere.counter2");
    r1.remove("counter1");
    metrics = ActivityMetrics.getMetricRegistry().getMetrics();
    assertThat(metrics).hasSize(extant+1);
    assertThat(metrics).containsKey("aprefixhere.counter2");
    r1.remove("counter2");
    metrics = ActivityMetrics.getMetricRegistry().getMetrics();
    assertThat(metrics).hasSize(extant);
}