From: Erik Brakkee Date: Mon, 25 Jul 2011 19:06:33 +0000 (+0000) Subject: added a testcase specifically for the modification time. X-Git-Tag: wamblee-utils-0.7~12 X-Git-Url: http://wamblee.org/gitweb/?a=commitdiff_plain;h=a22c221d1ed7f604828ce58985d06b7bdeb27376;p=utils added a testcase specifically for the modification time. --- diff --git a/support/general/src/test/java/org/wamblee/io/DirectoryMonitorTest.java b/support/general/src/test/java/org/wamblee/io/DirectoryMonitorTest.java index b148fafe..1bb4d020 100644 --- a/support/general/src/test/java/org/wamblee/io/DirectoryMonitorTest.java +++ b/support/general/src/test/java/org/wamblee/io/DirectoryMonitorTest.java @@ -75,6 +75,19 @@ public class DirectoryMonitorTest extends TestCase { verifyNoMoreInteractions(listener); } + public void testFileModificationTimeChanged() throws InterruptedException { + data.createFile(FILE1, "hello"); + monitor.poll(); + reset(listener); + data.deleteFile(FILE1); + Thread.sleep(2000); + data.createFile(FILE1, "hello"); + + monitor.poll(); + verify(listener).fileChanged(data.getFile(FILE1)); + verifyNoMoreInteractions(listener); + } + public void testFileFilterIsUsed() { monitor.poll(); @@ -94,8 +107,8 @@ public class DirectoryMonitorTest extends TestCase { monitor.poll(); data.createFile(FILE1, "hello"); - stubVoid(listener).toThrow(new RuntimeException()).on().fileCreated( - data.getFile(FILE1)); + stubVoid(listener).toThrow(new RuntimeException()).on() + .fileCreated(data.getFile(FILE1)); try { monitor.poll();