@Test public void shouldAddMBeanContainerAsEventListener() throws Exception { ArgumentCaptor<MBeanContainer> captor = ArgumentCaptor.forClass(MBeanContainer.class); jetty6Server.configure(); verify(container).addEventListener(captor.capture()); MBeanContainer mBeanContainer = captor.getValue(); assertThat(mBeanContainer.getMBeanServer(), is(not(nullValue()))); }
private MBeanContainer mbeans() { MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer(); MBeanContainer mbeans = new MBeanContainer(platformMBeanServer); mbeans.start(); return mbeans; }