(String[] args)
| 28 | } |
| 29 | } |
| 30 | public static void |
| 31 | main(String[] args) throws Exception { |
| 32 | Directories.refreshTestDir(); |
| 33 | Directories.populateTestDir(); |
| 34 | Files.createFile(test.resolve("Hello.txt")); |
| 35 | WatchService watcher = |
| 36 | FileSystems.getDefault().newWatchService(); |
| 37 | test.register(watcher, ENTRY_DELETE); |
| 38 | Executors.newSingleThreadScheduledExecutor() |
| 39 | .schedule( |
| 40 | PathWatcher::delTxtFiles, |
| 41 | 250, TimeUnit.MILLISECONDS); |
| 42 | WatchKey key = watcher.take(); |
| 43 | for(WatchEvent evt : key.pollEvents()) { |
| 44 | System.out.println( |
| 45 | "evt.context(): " + evt.context() + |
| 46 | "\nevt.count(): " + evt.count() + |
| 47 | "\nevt.kind(): " + evt.kind()); |
| 48 | System.exit(0); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | /* Output: |
| 53 | deleting test\bag\foo\bar\baz\File.txt |
nothing calls this directly
no test coverage detected