### Question:
SafeFiles { @Nonnegative public static int fsyncRecursive(final Path root) throws IOException { final FsyncingSimpleFileVisitor visitor = new FsyncingSimpleFileVisitor(); Files.walkFileTree(root, visitor); return visitor.getFileCount(); } private  SafeFiles(); static void rename(final Path oldName, final Path newName); static void ensureDirectoryExists(final Path path); @Nonnegative static int fsyncRecursive(final Path root); static void fsync(final Path path); static void writeUTF8(final String value, final Path path); static void write(final byte[] data, final Path path); @Nonnull static SafeOutputStream createAtomicFile(final Path path); static void deleteIfExistsQuietly(final Path path);  }### Answer:
@SuppressWarnings("ResultOfMethodCallIgnored") @Test public void fsyncRecursive() throws IOException { Assert.assertEquals(0, Directories.count(root)); tempDir.newFile("foo1"); tempDir.newFile("foo2"); final File dir = tempDir.newFolder("dir"); new File(dir, "bar1").createNewFile(); new File(dir, "bar2").createNewFile(); new File(dir, "bar3").createNewFile(); final File dir2 = new File(dir, "sub"); dir2.mkdir(); new File(dir2, "baz").createNewFile(); Assert.assertEquals(2 + 3 + 1, SafeFiles.fsyncRecursive(root)); }