### Question:
MetricName implements Comparable<MetricName> { public MetricName resolve(String p) { return resolve(p, true); } MetricName();  MetricName(String key);  MetricName(String key, Map<String, String> tags);  MetricName(String key, MetricLevel level);  MetricName(String key, Map<String, String> tags, MetricLevel level); String getKey(); Map<String, String> getTags(); MetricLevel getMetricLevel(); MetricName level(MetricLevel level); MetricName resolve(String p); MetricName resolve(String p, boolean inheritTags); MetricName tag(Map<String, String> add); MetricName tag(String... pairs); static MetricName join(MetricName... parts); static MetricName build(String... parts); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(MetricName o); static final String SEPARATOR; static final Map<String, String> EMPTY_TAGS; static final MetricName EMPTY; }### Answer:
@Test public void testEmptyResolve() { final MetricName name = new MetricName(); Assertions.assertEquals(name.resolve("foo"), new MetricName("foo")); }
@Test public void testResolveToEmpty() { final MetricName name = new MetricName("foo"); Assertions.assertEquals(name.resolve(null), new MetricName("foo")); }
@Test public void testResolve() { final MetricName name = new MetricName("foo"); Assertions.assertEquals(name.resolve("bar"), new MetricName("foo.bar")); }
@Test public void testResolveBothEmpty() { final MetricName name = new MetricName(null); Assertions.assertEquals(name.resolve(null), new MetricName()); }