### Question:
FileUtil { public static void walkTree (File root, Visitor visitor) { File[] children = root.listFiles(); if (children == null) return; Deque<File> stack = new ArrayDeque<>(Arrays.asList(children)); while (!stack.isEmpty()) { File currentFile = stack.pop(); if (currentFile.exists()) { visitor.visit(currentFile); File[] currentChildren = currentFile.listFiles(); if (currentChildren != null) { for (File file : currentChildren) { stack.push(file); } } } } }  static boolean renameTo(File source, File dest); static boolean deleteHarder(File file); static boolean deleteDirHarder(File file); static List<String> readLines(Reader in); static void unpackJar(ZipFile jar, File target, boolean cleanExistingDirs); static void unpackPacked200Jar(File packedJar, File target); static void copy(File source, File target); static void makeExecutable(File file); static void walkTree(File root, Visitor visitor);  }### Answer:
@Test public void shouldRecursivelyWalkOverFilesAndFolders () throws IOException { _folder.newFile("a.txt"); new File(_folder.newFolder("b"), "b.txt").createNewFile(); class CountingVisitor implements FileUtil.Visitor { int fileCount = 0; @Override public void visit(File file) { fileCount++; } } CountingVisitor visitor = new CountingVisitor(); FileUtil.walkTree(_folder.getRoot(), visitor); assertEquals(3, visitor.fileCount); }