added a testcase specifically for the modification time.
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Mon, 25 Jul 2011 19:06:33 +0000 (19:06 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Mon, 25 Jul 2011 19:06:33 +0000 (19:06 +0000)
support/general/src/test/java/org/wamblee/io/DirectoryMonitorTest.java

index b148fafebae6c98931d35a3adeca68aec1809db3..1bb4d02017d902bec371a05e13fce0ca87dcf5bc 100644 (file)
@@ -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();