/** * Test using a thread factory. * @throws Exception */ @Test public void testThreadFactory() throws Exception { final long interval = 100; listener.clear(); final FileAlterationMonitor monitor = new FileAlterationMonitor(interval, observer); monitor.setThreadFactory(Executors.defaultThreadFactory()); assertEquals("Interval", interval, monitor.getInterval()); monitor.start(); // Create a File checkCollectionsEmpty("A"); final File file2 = touch(new File(testDir, "file2.java")); checkFile("Create", file2, listener.getCreatedFiles()); listener.clear(); // Delete a file checkCollectionsEmpty("B"); file2.delete(); checkFile("Delete", file2, listener.getDeletedFiles()); listener.clear(); // Stop monitoring monitor.stop(); }