@Test
public void testRegisterMBean() throws Exception {

    final Logger ml = Mockito.mock(Logger.class);
    JmxWhiteboardSupport s = new JmxWhiteboardSupport() {
        @Override
        MBeanHolder createMBeanHolder(Object mbean, ObjectName objectName) {
            MBeanHolder mbh = super.createMBeanHolder(mbean, objectName);
            setPrivateField(mbh, "log", ml);
            return mbh;
        }
    };
    final Dictionary<String, Object> props = new Hashtable<String, Object>();
    props.put("jmx.objectname", "test:key=val");
    ServiceReference<?> sref = Mockito.mock(ServiceReference.class);
    Mockito.when(sref.getProperty(Mockito.anyString())).then(new Answer<Object>() {
        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            return props.get(invocation.getArguments()[0].toString());
        }
    });
    MBeanServer ms = mockMBeanServer();
    s.addMBeanServer(ms);
    Mockito.verify(ml, Mockito.never()).error(Mockito.anyString(), Mockito.isA(Throwable.class));
    Mockito.verify(ml, Mockito.never()).warn(Mockito.anyString(), Mockito.isA(Throwable.class));
    s.registerMBean(Mockito.mock(DynamicMBean.class), sref);
    Mockito.verify(ml, Mockito.never()).error(Mockito.anyString(), Mockito.isA(Throwable.class));
    Mockito.verify(ml, Mockito.never()).warn(Mockito.anyString(), Mockito.isA(Throwable.class));
}