@Test public void testGetFileListFromDirectory_WithInvalidPath_ReturnsEmptyList() throws IOException { File[] fileList = FileUtil.getFileListFromDirectory("testInvalidDir"); Assert.assertEquals("File list should contain empty list", 0, fileList.length); }
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);  }