### Question:
SynchronousFileWatcher { public boolean checkAndReset() throws IOException { if (checkUpdateMillis <= 0) { return checkForUpdate(); } else { final StateWrapper stateWrapper = lastState.get(); if (stateWrapper.getTimestamp() < System.currentTimeMillis() - checkUpdateMillis) { return checkForUpdate(); } return false; } } SynchronousFileWatcher(final Path path, final UpdateMonitor monitor);  SynchronousFileWatcher(final Path path, final UpdateMonitor monitor, final long checkMillis); boolean checkAndReset();  }### Answer:
@Test public void testIt() throws UnsupportedEncodingException, IOException, InterruptedException { final Path path = Paths.get("target/1.txt"); Files.copy(new ByteArrayInputStream("Hello, World!".getBytes("UTF-8")), path, StandardCopyOption.REPLACE_EXISTING); final UpdateMonitor monitor = new MD5SumMonitor(); final SynchronousFileWatcher watcher = new SynchronousFileWatcher(path, monitor, 10L); assertFalse(watcher.checkAndReset()); Thread.sleep(30L); assertFalse(watcher.checkAndReset()); final FileOutputStream fos = new FileOutputStream(path.toFile()); try { fos.write("Good-bye, World!".getBytes("UTF-8")); fos.getFD().sync(); } finally { fos.close(); } assertTrue(watcher.checkAndReset()); assertFalse(watcher.checkAndReset()); Thread.sleep(30L); assertFalse(watcher.checkAndReset()); }