@Test
public void testTaskMetricGroupCleanup() {

	CountingMetricRegistry registry = new CountingMetricRegistry(new Configuration());
	TaskManagerMetricGroup taskManagerMetricGroup = new TaskManagerMetricGroup(registry, "localhost", "0");
	TaskManagerJobMetricGroup taskManagerJobMetricGroup = new TaskManagerJobMetricGroup(registry, taskManagerMetricGroup, new JobID(), "job");
	TaskMetricGroup taskMetricGroup = new TaskMetricGroup(registry, taskManagerJobMetricGroup, new JobVertexID(), new AbstractID(), "task", 0, 0);
	// the io metric should have registered predefined metrics
	assertTrue(registry.getNumberRegisteredMetrics() > 0);
	taskMetricGroup.close();
	// now alle registered metrics should have been unregistered
	assertEquals(0, registry.getNumberRegisteredMetrics());
	registry.shutdown();
}