@Test public void testInvalidMapperDefaults() { Properties props = new Properties(); props.put("com.netflix.servo.DefaultMonitorRegistry.jmxMapperClass", "com.my.invalid.class"); DefaultMonitorRegistry registry = new DefaultMonitorRegistry(props); BasicCounter counter = new BasicCounter(new MonitorConfig.Builder("testInvalidMapperDefaults").build()); registry.register(counter); ObjectName expectedName = ObjectNameMapper.DEFAULT.createObjectName("com.netflix.servo", counter); assertEquals(expectedName.getDomain(), "com.netflix.servo"); assertTrue(ManagementFactory.getPlatformMBeanServer().isRegistered(expectedName)); }
@Override public ObjectName createObjectName(String domain, Monitor<?> monitor) { return ObjectNameMapper.DEFAULT.createObjectName(domain + ".Renamed", monitor); }