### Question:
FileUtils { public static boolean deleteFileIfExistsAndHandleException(Path file, Consumer<IOException> handler) { try { return Files.deleteIfExists(file); } catch (IOException e) { handler.accept(e); } return false; } private  FileUtils(); static boolean deleteFileIfExistsQuietly(Path file); static boolean deleteFileIfExistsAndHandleException(Path file, Consumer<IOException> handler); static boolean deleteFileIfExists(Path file); static void clearDirectorySilently(Path directory); static void deleteFilesByPattern(Path directory, String[] suffixes, String[] names); static void deleteFilesByFilter(Path directory, Predicate<Path> predicate); static long countElementsOfDirectory(Path directory);  }### Answer:
@Test void deleteFileIfExistsAndHandleException() throws IOException { Path directory = temporaryFolderExtension.newFolder().toPath(); Files.createFile(directory.resolve("file.txt")); boolean result = FileUtils.deleteFileIfExistsAndHandleException(directory, (e) -> assertEquals(DirectoryNotEmptyException.class, e.getClass())); assertFalse(result); assertTrue(Files.exists(directory)); }