@Test public void directoryHasChanged_returnsTrueWhenNoChecksumFile() throws Exception { final String checksumFilepath = "noSuchFile"; final String directoryPath = tempFolder.getRoot().getPath(); FileUpdateChecker checker = new FileUpdateChecker(checksumFilepath); assertTrue(checker.directoryHasChanged(directoryPath)); }
public boolean directoryHasChanged(String directoryPath) throws IOException { boolean ret = true; String dirHash = hashDirectory(directoryPath, true); if (checksums.containsKey(directoryPath)) { ret = !checksums.get(directoryPath).equals(dirHash); } checksums.put(directoryPath, dirHash); return ret; }
FileUpdateChecker { public boolean directoryHasChanged(String directoryPath) throws IOException { boolean ret = true; String dirHash = hashDirectory(directoryPath, true); if (checksums.containsKey(directoryPath)) { ret = !checksums.get(directoryPath).equals(dirHash); } checksums.put(directoryPath, dirHash); return ret; } }
FileUpdateChecker { public boolean directoryHasChanged(String directoryPath) throws IOException { boolean ret = true; String dirHash = hashDirectory(directoryPath, true); if (checksums.containsKey(directoryPath)) { ret = !checksums.get(directoryPath).equals(dirHash); } checksums.put(directoryPath, dirHash); return ret; } FileUpdateChecker(String checksumFilepath); }
FileUpdateChecker { public boolean directoryHasChanged(String directoryPath) throws IOException { boolean ret = true; String dirHash = hashDirectory(directoryPath, true); if (checksums.containsKey(directoryPath)) { ret = !checksums.get(directoryPath).equals(dirHash); } checksums.put(directoryPath, dirHash); return ret; } FileUpdateChecker(String checksumFilepath); boolean directoryHasChanged(String directoryPath); void writeChecksums(); }
FileUpdateChecker { public boolean directoryHasChanged(String directoryPath) throws IOException { boolean ret = true; String dirHash = hashDirectory(directoryPath, true); if (checksums.containsKey(directoryPath)) { ret = !checksums.get(directoryPath).equals(dirHash); } checksums.put(directoryPath, dirHash); return ret; } FileUpdateChecker(String checksumFilepath); boolean directoryHasChanged(String directoryPath); void writeChecksums();  }