JGitFileSystemsEventsManager { public void shutdown() { fsWatchServices.keySet().forEach(key -> this.close(key)); if (jGitEventsBroadcast != null) { jGitEventsBroadcast.close(); } } JGitFileSystemsEventsManager(); WatchService newWatchService(String fsName); void publishEvents(String fsName,
                              Path watchable,
                              List<WatchEvent<?>> elist); void publishEvents(String fsName,
                              Path watchable,
                              List<WatchEvent<?>> elist,
                              boolean broadcastEvents); void close(String name); void shutdown();  }
@Test public void testShutdown() { manager.newWatchService("fsPetra"); manager.newWatchService("fsEureka"); JGitFileSystemWatchServices fsPetraWatchService = manager.getFsWatchServices().get("fsPetra"); JGitFileSystemWatchServices fsEurekaWatchService = manager.getFsWatchServices().get("fsEureka"); manager.shutdown(); verify(fsPetraWatchService).close(); verify(fsEurekaWatchService).close(); verify(jGitEventsBroadcastMock).close(); }