JGitFileSystemsEventsManager { public void close(String name) { JGitFileSystemWatchServices watchService = fsWatchServices.get(name); if (watchService != null) { try { watchService.close(); } catch (final Exception ex) { LOGGER.error("Can't close watch service [" + toString() + "]", ex); } } } 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 closeTest() { manager.newWatchService("fsDora"); manager.newWatchService("fsBento"); JGitFileSystemWatchServices fsDoraWServices = manager.getFsWatchServices().get("fsDora"); JGitFileSystemWatchServices fsBentoWServices = manager.getFsWatchServices().get("fsBento"); manager.close("fsDora"); verify(fsDoraWServices).close(); verify(fsBentoWServices, never()).close(); }