FileExclusionManager { public boolean isExcluded(File file) { if (null != fileFilter) { do { if (fileFilter.accept(file)) { log.info("{} matched one or more exclude rules: excluding...", file.getAbsolutePath()); return true; } file = file.getParentFile(); } while (file != null); } return false; } FileExclusionManager(File excludeFile);  FileExclusionManager();  FileExclusionManager(List<String> excludeList); boolean isExcluded(File file);  }
@Test public void testReadExcludeList() throws IOException { String toExclude = "file.txt\n*.log\ndir?"; File excludeFile = new File("target", "excludelist.txt"); FileUtils.writeStringToFile(excludeFile, toExclude); File testExcluded1 = new File("file.txt"); File testExcluded2 = new File("dir0" + File.separator + "test.log"); File testNotExcluded = new File("good.txt"); FileExclusionManager fem = new FileExclusionManager(); assertFalse(fem.isExcluded(testExcluded1)); assertFalse(fem.isExcluded(testExcluded2)); assertFalse(fem.isExcluded(testNotExcluded)); fem = new FileExclusionManager(excludeFile); assertTrue(fem.isExcluded(testExcluded1)); assertTrue(fem.isExcluded(testExcluded2)); assertFalse(fem.isExcluded(testNotExcluded)); FileUtils.deleteQuietly(excludeFile); }