X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fio%2FDirectoryMonitorTest.java;h=1bb4d02017d902bec371a05e13fce0ca87dcf5bc;hb=e5f859aa0fcab5a3e4a754e5ebce475faa88a6d3;hp=87675cdbf269ae93aa1b00380ae1d6780231a6d1;hpb=5d6133ee706ff0647f29f9d6d36f4f12035699f9;p=utils 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 87675cdb..1bb4d020 100644 --- a/support/general/src/test/java/org/wamblee/io/DirectoryMonitorTest.java +++ b/support/general/src/test/java/org/wamblee/io/DirectoryMonitorTest.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.io; import static org.mockito.Mockito.*; @@ -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();