NvaMonitor implements AutoCloseable { public synchronized void stop() { log.info("Stopping NvaMonitor task"); isRunning = false; lock.lock(); try { log.debug("Signalling NvaMonitor condition"); shutdown.signal(); log.debug("Signalled NvaMonitor condition"); } finally { lock.unlock(); } } NvaMonitor(DaemonConfiguration configuration); synchronized Future<Void> start(); synchronized void stop(); @Override synchronized void close();  }
@Test void testStop() throws NvaMonitor.NvaMonitorException { List<MonitorConfiguration> monitors = new ArrayList<>(); Map<String, Object> settings = new HashMap<>(); settings.put("constructorShouldThrowException", "false"); settings.put("initShouldCauseInterrupt", "false"); monitors.add( new MonitorConfiguration( "com.microsoft.azure.practices.nvadaemon.NvaMonitorTest$MonitorValidConstructor", settings)); DaemonConfiguration daemonConfiguration = new DaemonConfiguration(monitors, null); NvaMonitor nvaMonitor = new NvaMonitor(daemonConfiguration); nvaMonitor.start(); nvaMonitor.stop(); }