AdeFileUtils { public static void deleteFile(File file) throws AdeUsageException { if (!file.delete()) { throw new AdeUsageException(FAILED_DELETING_FILE + file.getPath()); } } private  AdeFileUtils(); static void copyFile(File source, File target); static BufferedReader openLogFile(File file); static InputStream openLogFileAsInputStream(File file); static void deleteFile(File file); static void deleteFileOrLog(File file); static void createDir(File target); static void createDirs(File target); static boolean deleteRecursiveOrLog(File path);  }
@Test(expected = AdeUsageException.class) public void testDeleteFileWithFileNotExist() throws AdeUsageException { final File emptyFile = new File("fakefile"); AdeFileUtils.deleteFile(emptyFile); }
@Test public void testDeleteFile() throws AdeUsageException, IOException { final File targetFile = temporaryFolder.newFile("file"); AdeFileUtils.deleteFile(targetFile); assertFalse("Verify that the file was deleted.", targetFile.exists()); }