### Question:
FileUtils { public static boolean deleteDir(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { return false; } } } return dir.delete(); }  static boolean deleteDir(File dir);  }### Answer:
@Test public void deleteDir() throws Exception { File dir = new File("build/files"); dir.mkdirs(); File file = new File(dir, "myfile"); file.createNewFile(); Assert.assertTrue(file.exists()); Assert.assertFalse(dir.delete()); Assert.assertTrue(dir.exists()); FileUtils.deleteDir(dir); Assert.assertFalse(dir.exists()); }