MeterId { public MeterId copyTo(String name, MeterType type) { return new MeterId(name, type, tags); } MeterId(String name, MeterType type);  MeterId(String name, MeterType type, List<Tag> tags); String getName(); MeterType getType(); List<Tag> getTags(); MeterId copyTo(String name, MeterType type); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testCopyTo() { final MeterId meterId = new MeterId("test", MeterId.MeterType.COUNTER, Arrays.asList(new MeterId.Tag("k1", "v1"))); final MeterId copied = meterId.copyTo("test_copied", MeterId.MeterType.GAUGE); Assert.assertEquals("test_copied", copied.getName()); Assert.assertEquals(MeterId.MeterType.GAUGE, copied.getType()); Assert.assertEquals(meterId.getTags(), copied.getTags()); }