@Test(expected = IllegalArgumentException.class) public void testValidateUnreadableDirectory() throws FileNotFoundException { MovieManager.validateFile(new File("src/test/resources/unreadable")); }
public static void validateFile(File... files) throws FileNotFoundException { FileNameExtensionFilter extensionFilter = new FileNameExtensionFilter( "Microsoft Excel", "xls", "xlsx"); for (File file : files) { if (file == null) { logger.error("File not found."); throw new FileNotFoundException("File not found."); } else if (!file.isDirectory() && !extensionFilter.accept(file)) { logger.error("File extension is not acceptable: " + file.getAbsolutePath()); throw new IllegalArgumentException( "File extension is not acceptable."); } else if (file.isDirectory() && (!file.canRead() || !file.canExecute())) { logger.error("Directory not found or is not readable: " + file.getAbsolutePath()); throw new IllegalArgumentException( "Directory not found or is not readable."); } } }
MovieManager { public static void validateFile(File... files) throws FileNotFoundException { FileNameExtensionFilter extensionFilter = new FileNameExtensionFilter( "Microsoft Excel", "xls", "xlsx"); for (File file : files) { if (file == null) { logger.error("File not found."); throw new FileNotFoundException("File not found."); } else if (!file.isDirectory() && !extensionFilter.accept(file)) { logger.error("File extension is not acceptable: " + file.getAbsolutePath()); throw new IllegalArgumentException( "File extension is not acceptable."); } else if (file.isDirectory() && (!file.canRead() || !file.canExecute())) { logger.error("Directory not found or is not readable: " + file.getAbsolutePath()); throw new IllegalArgumentException( "Directory not found or is not readable."); } } } }
MovieManager { public static void validateFile(File... files) throws FileNotFoundException { FileNameExtensionFilter extensionFilter = new FileNameExtensionFilter( "Microsoft Excel", "xls", "xlsx"); for (File file : files) { if (file == null) { logger.error("File not found."); throw new FileNotFoundException("File not found."); } else if (!file.isDirectory() && !extensionFilter.accept(file)) { logger.error("File extension is not acceptable: " + file.getAbsolutePath()); throw new IllegalArgumentException( "File extension is not acceptable."); } else if (file.isDirectory() && (!file.canRead() || !file.canExecute())) { logger.error("Directory not found or is not readable: " + file.getAbsolutePath()); throw new IllegalArgumentException( "Directory not found or is not readable."); } } } MovieManager();  MovieManager(File inputDir, File outputFile); }
MovieManager { public static void validateFile(File... files) throws FileNotFoundException { FileNameExtensionFilter extensionFilter = new FileNameExtensionFilter( "Microsoft Excel", "xls", "xlsx"); for (File file : files) { if (file == null) { logger.error("File not found."); throw new FileNotFoundException("File not found."); } else if (!file.isDirectory() && !extensionFilter.accept(file)) { logger.error("File extension is not acceptable: " + file.getAbsolutePath()); throw new IllegalArgumentException( "File extension is not acceptable."); } else if (file.isDirectory() && (!file.canRead() || !file.canExecute())) { logger.error("Directory not found or is not readable: " + file.getAbsolutePath()); throw new IllegalArgumentException( "Directory not found or is not readable."); } } } MovieManager();  MovieManager(File inputDir, File outputFile); static void validateFile(File... files); static GenreSummary getSummaryByGenre(String genre); static Summary getSummary(); static Map<String, Set<Movie>> getMovieSetGroupedByGenre(); static void createSummarySheet(Summary summary); static void createGenreSheet(Set<Movie> filteredMovieSetByGenre,
			String genre); static Summary getSummary(
			Map<String, Set<Movie>> movieSetGroupedByGenre); }
MovieManager { public static void validateFile(File... files) throws FileNotFoundException { FileNameExtensionFilter extensionFilter = new FileNameExtensionFilter( "Microsoft Excel", "xls", "xlsx"); for (File file : files) { if (file == null) { logger.error("File not found."); throw new FileNotFoundException("File not found."); } else if (!file.isDirectory() && !extensionFilter.accept(file)) { logger.error("File extension is not acceptable: " + file.getAbsolutePath()); throw new IllegalArgumentException( "File extension is not acceptable."); } else if (file.isDirectory() && (!file.canRead() || !file.canExecute())) { logger.error("Directory not found or is not readable: " + file.getAbsolutePath()); throw new IllegalArgumentException( "Directory not found or is not readable."); } } } MovieManager();  MovieManager(File inputDir, File outputFile); static void validateFile(File... files); static GenreSummary getSummaryByGenre(String genre); static Summary getSummary(); static Map<String, Set<Movie>> getMovieSetGroupedByGenre(); static void createSummarySheet(Summary summary); static void createGenreSheet(Set<Movie> filteredMovieSetByGenre,
			String genre); static Summary getSummary(
			Map<String, Set<Movie>> movieSetGroupedByGenre); static final String EMPTY; }