MonitoringInfoConstants { @VisibleForTesting static String extractUrn(MonitoringInfoSpecs.Enum value) { return value.getValueDescriptor().getOptions().getExtension(monitoringInfoSpec).getUrn(); }    }
@Test public void testUniqueUrnsDefinedForAllSpecs() { Multimap<String, MonitoringInfoSpecs.Enum> urnToEnum = ArrayListMultimap.create(); for (MonitoringInfoSpecs.Enum value : MonitoringInfoSpecs.Enum.values()) { if (value != MonitoringInfoSpecs.Enum.UNRECOGNIZED) { urnToEnum.put(extractUrn(value), value); } } for (String urn : ImmutableSet.copyOf(urnToEnum.keySet())) { if (urnToEnum.get(urn).size() == 1) { urnToEnum.removeAll(urn); } } assertThat(urnToEnum.entries(), Matchers.empty()); }