### Question:
UtilFile { public static List<File> getFiles(File directory) { Check.notNull(directory); if (directory.isDirectory()) { final File[] files = directory.listFiles(); if (files != null) { return Arrays.asList(files); } } throw new LionEngineException(ERROR_DIRECTORY + directory.getPath()); } private  UtilFile(); static String removeExtension(String file); static String normalizeExtension(String file, String extension); static String getExtension(String file); static String getExtension(File file); static List<File> getFiles(File directory); static List<File> getFilesByExtension(File path, String extension); static List<File> getFilesByName(File path, String name); static void deleteFile(File file); static boolean exists(String path); static boolean isFile(String path); static boolean isType(File file, String extension);  }### Answer:
@Test void testGetFiles() throws IOException { final Path folder = Files.createTempDirectory("temp"); final Path file1 = Files.createTempFile(folder, "temp", ".tmp"); final Path file2 = Files.createTempFile(folder, "temp", ".tmp"); final File dir = folder.toFile(); final List<File> found = new ArrayList<>(UtilFile.getFiles(dir)); final List<File> expected = Arrays.asList(file1.toFile(), file2.toFile()); Collections.sort(found); Collections.sort(expected); assertEquals(expected, found); Files.delete(file1); Files.delete(file2); Files.delete(folder); }
@Test void testGetFilesError() throws IOException { assertThrows(() -> UtilFile.getFiles(new File("void")), UtilFile.ERROR_DIRECTORY + "void"); }
@Test void testGetFilesNull() throws IOException { assertThrows(() -> UtilFile.getFiles(new File("void") { @Override public boolean isDirectory() { return true; } @Override public File[] listFiles() { return null; } }), UtilFile.ERROR_DIRECTORY + "void"); }