void () { setupVisitorTestDirectories(); Map<String, Integer> result = new HashMap<>(); FileUtil.processFilesRecursively(tempDir.getRoot(), file -> { Integer integer = result.get(file.getName()); result.put(file.getName(), integer == null ? 1 : (integer + 1)); return true; }, file -> ! "dir2".equals(file.getName())); assertEquals(5, result.size()); assertEquals(1, result.get(tempDir.getRoot().getName()).intValue()); assertEquals(1, result.get("1").intValue()); assertEquals(1, result.get("2").intValue()); assertEquals(1, result.get("dir1").intValue()); assertEquals(1, result.get("dir2").intValue()); assertNull(result.get("dir21")); }