### Question:
Analyzer { protected Set<File> getFiles(File file, Set<File> files) { if (file.isFile()) { files.add(file); } else if (file.isDirectory()) { File[] filesInFolder = file.listFiles(); for (File fileInFolder : filesInFolder) { getFiles(fileInFolder, files); } } return files; }  AnalyzerResult analyze(List<String> filePaths);  }### Answer:
@Test public void test_getFiles__directory() { File root = new File(path + "test/"); File file = new File(path + "test/test_pair.txt"); File file2 = new File(path + "test/test_pair2.txt"); Set<File> expectedFiles = new HashSet<>(); expectedFiles.add(file); expectedFiles.add(file2); Set<File> files = new HashSet<>(); Set<File> actualFiles = processor.getFiles(root, files); assertThat(actualFiles, is(expectedFiles)); }
@Test public void test_getFiles__nested_directory() { File root = new File(path + "test_nested/"); File file = new File(path + "test_nested/test_pair.txt"); File file2 = new File(path + "test_nested/other/test_pair.txt"); Set<File> expectedFiles = new HashSet<>(); expectedFiles.add(file); expectedFiles.add(file2); Set<File> files = new HashSet<>(); Set<File> actualFiles = processor.getFiles(root, files); assertThat(actualFiles, is(expectedFiles)); }
@Test public void test_getFiles__file_not_found() { String rootPath = path + "notFound/"; File root = new File(rootPath); Set<File> files = new HashSet<>(); Set<File> actualFiles = processor.getFiles(root, files); assertThat(actualFiles.isEmpty(), is(true)); }