Skip to content

Commit

Permalink
updating the FileWatcherTest case
Browse files Browse the repository at this point in the history
  • Loading branch information
laminba2003 committed Nov 28, 2019
1 parent d3bbbdf commit bdea10d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/test/java/org/gservlet/FileWatcherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,20 @@ public void onDeleted(String name) {

}).watch();
assertEquals(1, watcher.getListeners().size());
Thread.sleep(2000);
wait(2000);
File file = new File("src/test/resources/test.txt");
PrintWriter printWriter = new PrintWriter(new FileWriter(file));
printWriter.print("Some String");
printWriter.close();
Thread.sleep(2000);
wait(2000);
file.delete();
Thread.sleep(2000);
wait(2000);
assertEquals(file.getName(), map.get("file.created"));
assertEquals(file.getName(), map.get("file.deleted"));
}

public void wait(int seconds) throws InterruptedException {
Thread.sleep(seconds);
}

}

0 comments on commit bdea10d

Please sign in to comment.