Metrics { public Sensor sensor(String name) { return sensor(name, null, (Sensor[]) null); } Metrics();  Metrics(Time time);  Metrics(MetricConfig defaultConfig);  Metrics(MetricConfig defaultConfig, List<MetricsReporter> reporters, Time time); Sensor getSensor(String name); Sensor sensor(String name); Sensor sensor(String name, Sensor... parents); synchronized Sensor sensor(String name, MetricConfig config, Sensor... parents); void addMetric(MetricName metricName, Measurable measurable); synchronized void addMetric(MetricName metricName, MetricConfig config, Measurable
      measurable); synchronized void addReporter(MetricsReporter reporter); Map<MetricName, KafkaMetric> metrics(); void close();  }
@Test(expected = IllegalArgumentException.class) public void testBadSensorHiearchy() { Sensor p = metrics.sensor("parent"); Sensor c1 = metrics.sensor("child1", p); Sensor c2 = metrics.sensor("child2", p); metrics.sensor("gc", c1, c2); }
@Test(expected = IllegalArgumentException.class) public void testDuplicateMetricName() { metrics.sensor("test").add(new MetricName("test", "grp1"), new Avg()); metrics.sensor("test2").add(new MetricName("test", "grp1"), new Total()); }