### Question:
PosixFileOperations { public static void rmrf(File file) throws IOException { Process rmProc = Runtime.getRuntime().exec(new String[]{"rm", "-rf", file.getAbsolutePath()}, null); try { int result = rmProc.waitFor(); if (result != 0) { throw new IOException( formatWithStdStreams( rmProc, "error running rm process, exit code: " + result + "\nstdout:\n%s\nstderr:\n%s" )); } } catch (InterruptedException e) { log.error("exception during exec", e); throw new IOException("exec failed", e); } }  static void atomicLink(File target, File link); static void link(File target, File link); static void rmrf(File file); static void rmrf(Path path); static void cplr(File src, File dest); static void cplr(final Path src, final Path dest); static void recursiveCopy(File srcDir, File destDir); static void recursiveCopy(final Path src, final Path dest); static long du(File path); static String relativePath(String base, String path); static String relativePath(File base, File path); static String lsla(File file); static int getPID(); static boolean isProcessRunning(int pid, boolean assumeRunning); static Integer tryParseInt(String str); static Integer tryParseInt(String str, int radix);  }### Answer:
@Test public void testRmRf() throws IOException { final Path rootDir = tempDir.getRoot().toPath(); final Path aDir = Files.createDirectory(rootDir.resolve("a")); final Path file1 = Files.createFile(aDir.resolve("file1")); final Path file2 = Files.createFile(aDir.resolve("file2")); final Path bDir = Files.createDirectory(aDir.resolve("b")); final Path file3 = Files.createFile(bDir.resolve("file3")); final Path file4 = Files.createFile(bDir.resolve("file4")); final Path cDir = Files.createDirectory(aDir.resolve("c")); final Path file5 = Files.createFile(cDir.resolve("file5")); final Path file6 = Files.createFile(cDir.resolve("file6")); final Path dDir = Files.createDirectory(cDir.resolve("d")); final Path file7 = Files.createFile(dDir.resolve("file7")); final Path file8 = Files.createFile(dDir.resolve("file8")); { final CountFileVisitor countFileVisitor = new CountFileVisitor(); Files.walkFileTree(rootDir, countFileVisitor); Assert.assertEquals(5, countFileVisitor.dirs); Assert.assertEquals(8, countFileVisitor.files); } PosixFileOperations.rmrf(cDir.toFile()); { final CountFileVisitor countFileVisitor = new CountFileVisitor(); Files.walkFileTree(rootDir, countFileVisitor); Assert.assertEquals(3, countFileVisitor.dirs); Assert.assertEquals(4, countFileVisitor.files); } PosixFileOperations.rmrf(aDir); { final CountFileVisitor countFileVisitor = new CountFileVisitor(); Files.walkFileTree(rootDir, countFileVisitor); Assert.assertEquals(1, countFileVisitor.dirs); Assert.assertEquals(0, countFileVisitor.files); } }