@Test public void testGetFileListFromDirectory_WithAvailablePath_ReturnsList() throws IOException { cleanRegularFile(); populateTemporaryFolder(); File[] fileList = FileUtil.getFileListFromDirectory(this.homeDirectory.getAbsolutePath()); Assert.assertEquals("File list should contain all files", this.numberOfFilesInDirectory, fileList.length); for (File loadedFile : fileList) { Assert.assertTrue(loadedFile.getName().contains("test_")); } }
public static File[] getFileListFromDirectory(String directory) throws FileNotFoundException { if (directory == null) { throw new FileNotFoundException("Cannot obtain list of files from directory - null given"); } File fileDir = new File(directory); if (fileDir.exists()) { File[] listFiles = fileDir.listFiles(); if (listFiles != null) { return listFiles; } } return new File[0]; }
FileUtil { public static File[] getFileListFromDirectory(String directory) throws FileNotFoundException { if (directory == null) { throw new FileNotFoundException("Cannot obtain list of files from directory - null given"); } File fileDir = new File(directory); if (fileDir.exists()) { File[] listFiles = fileDir.listFiles(); if (listFiles != null) { return listFiles; } } return new File[0]; } }
FileUtil { public static File[] getFileListFromDirectory(String directory) throws FileNotFoundException { if (directory == null) { throw new FileNotFoundException("Cannot obtain list of files from directory - null given"); } File fileDir = new File(directory); if (fileDir.exists()) { File[] listFiles = fileDir.listFiles(); if (listFiles != null) { return listFiles; } } return new File[0]; }  }
FileUtil { public static File[] getFileListFromDirectory(String directory) throws FileNotFoundException { if (directory == null) { throw new FileNotFoundException("Cannot obtain list of files from directory - null given"); } File fileDir = new File(directory); if (fileDir.exists()) { File[] listFiles = fileDir.listFiles(); if (listFiles != null) { return listFiles; } } return new File[0]; }  static File[] getFileListFromDirectory(String directory); static Properties loadProperties(String propertiesFilePath); }
FileUtil { public static File[] getFileListFromDirectory(String directory) throws FileNotFoundException { if (directory == null) { throw new FileNotFoundException("Cannot obtain list of files from directory - null given"); } File fileDir = new File(directory); if (fileDir.exists()) { File[] listFiles = fileDir.listFiles(); if (listFiles != null) { return listFiles; } } return new File[0]; }  static File[] getFileListFromDirectory(String directory); static Properties loadProperties(String propertiesFilePath);  }