package org.boni.parallely.service; import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.WatchEvent; import org.junit.Test; public class TestFolderWatcher { @Test public void testFutureWatchService() throws IOException { FolderWatchers.getInstance().addFolderListener(Paths.get("c:/boni/"), new ChangeListener(ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY) { @Override public void onEvent(WatchEvent anEvent) { System.out.println("LISTENER 1 " + anEvent.kind().name().toString() + " " + anEvent.context()); } }); FolderWatchers.getInstance().addFolderListener(Paths.get("C:/boni/installs"), new ChangeListener(ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY) { @Override public void onEvent(WatchEvent anEvent) { System.out.println("LISTENER 2 " + anEvent.kind().name().toString() + " " + anEvent.context()); } }); while (true) { ; } } }