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; }); assertEquals(6, result.size()); assertEquals(1, result.get(tempDir.getRoot().getName()).intValue()); assertEquals(3, result.get("1").intValue()); assertEquals(3, result.get("2").intValue()); assertEquals(1, result.get("dir1").intValue()); }