@Test public void testSaveFileBatch() throws IOException { assertFalse(DirectoryWatcher.isDirEmpty(inDir)); assertTrue(DirectoryWatcher.isDirEmpty(outDir)); saver.save(batch); assertFalse(DirectoryWatcher.isDirEmpty(inDir)); assertFalse(DirectoryWatcher.isDirEmpty(outDir)); DirectoryStream<Path> ds = Files.newDirectoryStream(outDir); int counter = 0; for (Path p : ds) { if (!Files.exists(p) || !Files.isRegularFile(p)) { fail("Path " + p + " was supposed to be a properties file, but an error occured while checking."); } counter++; Properties props = new Properties(); props.load(Files.newInputStream(p)); final String base = "filepath"; for (int i = 0; i < 100; i++) { if (i >= 10) { assertNull(props.getProperty(base + i)); } else { assertNotNull(props.getProperty(base + i)); } } } assertEquals(batch.size(), counter); }
public void saveFileBatch(final List<FileEntry> fileBatch) throws IOException { for (FileEntry entry : fileBatch) { saveFileEntry(entry); } }
FileSaver implements Saver { public void saveFileBatch(final List<FileEntry> fileBatch) throws IOException { for (FileEntry entry : fileBatch) { saveFileEntry(entry); } } }
FileSaver implements Saver { public void saveFileBatch(final List<FileEntry> fileBatch) throws IOException { for (FileEntry entry : fileBatch) { saveFileEntry(entry); } } FileSaver(Path directory); }
FileSaver implements Saver { public void saveFileBatch(final List<FileEntry> fileBatch) throws IOException { for (FileEntry entry : fileBatch) { saveFileEntry(entry); } } FileSaver(Path directory); @Override void save(final List<? extends AbstractEntry> batch); void saveFileBatch(final List<FileEntry> fileBatch); void saveFileEntry(FileEntry e); }
FileSaver implements Saver { public void saveFileBatch(final List<FileEntry> fileBatch) throws IOException { for (FileEntry entry : fileBatch) { saveFileEntry(entry); } } FileSaver(Path directory); @Override void save(final List<? extends AbstractEntry> batch); void saveFileBatch(final List<FileEntry> fileBatch); void saveFileEntry(FileEntry e);  }