### Question:
AbstractMetricGroup implements MetricGroup { public String getMetricIdentifier(String metricName) { return getMetricIdentifier(metricName, null); } AbstractMetricGroup(MetricRegistry registry, String[] scope, A parent); Map<String, String> getAllVariables(); String getLogicalScope(CharacterFilter filter); String getLogicalScope(CharacterFilter filter, char delimiter); String[] getScopeComponents(); QueryScopeInfo getQueryServiceMetricInfo(CharacterFilter filter); String getMetricIdentifier(String metricName); String getMetricIdentifier(String metricName, CharacterFilter filter); String getMetricIdentifier(String metricName, CharacterFilter filter, int reporterIndex); void close(); final boolean isClosed(); @Override Counter counter(int name); @Override Counter counter(String name); @Override C counter(int name, C counter); @Override C counter(String name, C counter); @Override G gauge(int name, G gauge); @Override G gauge(String name, G gauge); @Override H histogram(int name, H histogram); @Override H histogram(String name, H histogram); @Override M meter(int name, M meter); @Override M meter(String name, M meter); @Override MetricGroup addGroup(int name); @Override MetricGroup addGroup(String name); @Override MetricGroup addGroup(String key, String value);  }### Answer:
@Test public void testScopeGenerationWithoutReporters() throws Exception { Configuration config = new Configuration(); config.setString(MetricOptions.SCOPE_NAMING_TM, "A.B.C.D"); MetricRegistryImpl testRegistry = new MetricRegistryImpl(MetricRegistryConfiguration.fromConfiguration(config)); try { TaskManagerMetricGroup group = new TaskManagerMetricGroup(testRegistry, "host", "id"); assertEquals("MetricReporters list should be empty", 0, testRegistry.getReporters().size()); assertEquals("A.B.X.D.1", group.getMetricIdentifier("1", FILTER_C)); assertEquals("A.X.C.D.1", group.getMetricIdentifier("1", FILTER_B)); assertEquals("A.X.C.D.1", group.getMetricIdentifier("1", FILTER_B, -1)); assertEquals("A.X.C.D.1", group.getMetricIdentifier("1", FILTER_B, 2)); } finally { testRegistry.shutdown().get(); } }
@Test public void testScopeGenerationWithoutReporters() throws Exception { Configuration config = new Configuration(); config.setString(MetricOptions.SCOPE_NAMING_TM, "A.B.C.D"); MetricRegistryImpl testRegistry = new MetricRegistryImpl( MetricRegistryConfiguration.fromConfiguration(config)); try { TaskManagerMetricGroup group = new TaskManagerMetricGroup(testRegistry, "host", "id"); assertEquals("MetricReporters list should be empty", 0, testRegistry.getReporters().size()); assertEquals("A.B.X.D.1", group.getMetricIdentifier("1", FILTER_C)); assertEquals("A.X.C.D.1", group.getMetricIdentifier("1", FILTER_B)); assertEquals("A.X.C.D.1", group.getMetricIdentifier("1", FILTER_B, -1)); assertEquals("A.X.C.D.1", group.getMetricIdentifier("1", FILTER_B, 2)); } finally { testRegistry.shutdown().get(); } }