### Question:
Metrics implements Closeable { public MetricName metricName(String name, String group, String description, Map<String, String> tags) { Map<String, String> combinedTag = new LinkedHashMap<>(config.tags()); combinedTag.putAll(tags); return new MetricName(name, group, description, combinedTag); } Metrics();  Metrics(Time time);  Metrics(MetricConfig defaultConfig, Time time);  Metrics(MetricConfig defaultConfig);  Metrics(MetricConfig defaultConfig, List<MetricsReporter> reporters, Time time);  Metrics(MetricConfig defaultConfig, List<MetricsReporter> reporters, Time time, boolean enableExpiration); MetricName metricName(String name, String group, String description, Map<String, String> tags); MetricName metricName(String name, String group, String description); MetricName metricName(String name, String group); MetricName metricName(String name, String group, String description, String... keyValue); MetricName metricName(String name, String group, Map<String, String> tags); static String toHtmlTable(String domain, List<MetricNameTemplate> allMetrics); MetricConfig config(); Sensor getSensor(String name); Sensor sensor(String name); Sensor sensor(String name, Sensor.RecordingLevel recordingLevel); Sensor sensor(String name, Sensor... parents); Sensor sensor(String name, Sensor.RecordingLevel recordingLevel, Sensor... parents); synchronized Sensor sensor(String name, MetricConfig config, Sensor... parents); synchronized Sensor sensor(String name, MetricConfig config, Sensor.RecordingLevel recordingLevel, Sensor... parents); synchronized Sensor sensor(String name, MetricConfig config, long inactiveSensorExpirationTimeSeconds, Sensor.RecordingLevel recordingLevel, Sensor... parents); synchronized Sensor sensor(String name, MetricConfig config, long inactiveSensorExpirationTimeSeconds, Sensor... parents); void removeSensor(String name); void addMetric(MetricName metricName, Measurable measurable); synchronized void addMetric(MetricName metricName, MetricConfig config, Measurable measurable); synchronized KafkaMetric removeMetric(MetricName metricName); synchronized void addReporter(MetricsReporter reporter); Map<MetricName, KafkaMetric> metrics(); List<MetricsReporter> reporters(); KafkaMetric metric(MetricName metricName); MetricName metricInstance(MetricNameTemplate template, String... keyValue); MetricName metricInstance(MetricNameTemplate template, Map<String, String> tags); @Override void close();  }### Answer:
@Test public void testMetricName() { MetricName n1 = metrics.metricName("name", "group", "description", "key1", "value1", "key2", "value2"); Map<String, String> tags = new HashMap<String, String>(); tags.put("key1", "value1"); tags.put("key2", "value2"); MetricName n2 = metrics.metricName("name", "group", "description", tags); assertEquals("metric names created in two different ways should be equal", n1, n2); try { metrics.metricName("name", "group", "description", "key1"); fail("Creating MetricName with an odd number of keyValue should fail"); } catch (IllegalArgumentException e) { } }