@Test public void should_not_report_node_info_when_disabled() throws ConfigurationException, InterruptedException { InfoProvider infoProvider = mock(InfoProvider.class); NodeInfo nodeInfo = new NodeInfo(false, false, false, 0, 0); when(infoProvider.getNodeInfo()).thenReturn(nodeInfo); PowerMockito.mockStatic(DiagnosticsAgent.class); PowerMockito.when(DiagnosticsAgent.getInfoProvider()).thenReturn(infoProvider); final CountDownLatch latch = new CountDownLatch(1); final LatchTestReporter testReporter = new LatchTestReporter(null, GlobalConfiguration.getDefault(), latch); final List<Reporter> reporters = new ArrayList<Reporter>() { { add(testReporter); } }; final StatusModule module = new StatusModule(testConfiguration(1, false, false, false, false), reporters, GlobalConfiguration.getDefault()); boolean wait = latch.await(1100, TimeUnit.MILLISECONDS); module.stop(); assertThat(wait).isFalse(); assertThat(testReporter.getReported().size()).isEqualTo(0); }
@Override public void stop() { logger.trace("Stopping status module."); timer.cancel(); }
StatusModule extends Module { @Override public void stop() { logger.trace("Stopping status module."); timer.cancel(); } }
StatusModule extends Module { @Override public void stop() { logger.trace("Stopping status module."); timer.cancel(); } StatusModule(ModuleConfiguration configuration, List<Reporter> reporters,
            final GlobalConfiguration globalConfiguration); }
StatusModule extends Module { @Override public void stop() { logger.trace("Stopping status module."); timer.cancel(); } StatusModule(ModuleConfiguration configuration, List<Reporter> reporters,
            final GlobalConfiguration globalConfiguration); @Override void stop(); }
StatusModule extends Module { @Override public void stop() { logger.trace("Stopping status module."); timer.cancel(); } StatusModule(ModuleConfiguration configuration, List<Reporter> reporters,
            final GlobalConfiguration globalConfiguration); @Override void stop();  }