### Question:
FileUtils { public static void purgeDirectory(File directory) { if (!directory.isDirectory()) { return; } File[] files = directory.listFiles(); if (files == null) { return; } for (File target : files) { if (target.isDirectory()) { purgeDirectory(target); } delete(target); } } private  FileUtils(); static boolean copyFileFromResource(File destinationFile, String resourcePath); static boolean createDirectory(File dir); static InputStream getResourceFromJar(String path); static void purgeDirectory(File directory); static void delete(File file); static void create(File file); static String makePath(String... elements); static String createCurrentTimeString(); static String createBackupFilePath(File file);  }### Answer:
@Test public void shouldPurgeDirectory() throws IOException { File root = temporaryFolder.newFolder(); File file1 = new File(root, "a/b/c/test.html"); File file2 = new File(root, "a/b/f/toast.txt"); File file3 = new File(root, "a/g/rest.png"); File file4 = new File(root, "j/l/roast.tiff"); createFiles(file1, file2, file3, file4); FileUtils.purgeDirectory(new File(root, "a")); assertThat(file1.exists(), equalTo(false)); assertThat(file2.exists(), equalTo(false)); assertThat(file3.exists(), equalTo(false)); assertThat(file4.exists(), equalTo(true)); assertThat(new File(root, "a").exists(), equalTo(true)); }