@Test public void test_processFiles__notFound() { String rootPath = path + "notFound/"; List<String> rootPaths = new LinkedList<>(); rootPaths.add(rootPath); try { processor.analyze(rootPaths); fail("Should throw an exception!"); } catch (FileNotFoundException e) { assertThat("File not found: " + rootPath, is(e.getMessage())); } }
public AnalyzerResult analyze(List<String> filePaths) throws FileNotFoundException { if (filePaths == null || filePaths.isEmpty()) { return null; } List<File> files = new LinkedList<>(); for (String filePath : filePaths) { File file = new File(filePath); if (file.exists()) { files.add(file); } else { throw new FileNotFoundException("File not found: " + filePath); } } Map<String, List<MarkerPair>> result = analyzeFiles(files); AnalyzerResult analyzerResult = new AnalyzerResult(result); return analyzerResult; }
Analyzer { public AnalyzerResult analyze(List<String> filePaths) throws FileNotFoundException { if (filePaths == null || filePaths.isEmpty()) { return null; } List<File> files = new LinkedList<>(); for (String filePath : filePaths) { File file = new File(filePath); if (file.exists()) { files.add(file); } else { throw new FileNotFoundException("File not found: " + filePath); } } Map<String, List<MarkerPair>> result = analyzeFiles(files); AnalyzerResult analyzerResult = new AnalyzerResult(result); return analyzerResult; } }
Analyzer { public AnalyzerResult analyze(List<String> filePaths) throws FileNotFoundException { if (filePaths == null || filePaths.isEmpty()) { return null; } List<File> files = new LinkedList<>(); for (String filePath : filePaths) { File file = new File(filePath); if (file.exists()) { files.add(file); } else { throw new FileNotFoundException("File not found: " + filePath); } } Map<String, List<MarkerPair>> result = analyzeFiles(files); AnalyzerResult analyzerResult = new AnalyzerResult(result); return analyzerResult; }  }
Analyzer { public AnalyzerResult analyze(List<String> filePaths) throws FileNotFoundException { if (filePaths == null || filePaths.isEmpty()) { return null; } List<File> files = new LinkedList<>(); for (String filePath : filePaths) { File file = new File(filePath); if (file.exists()) { files.add(file); } else { throw new FileNotFoundException("File not found: " + filePath); } } Map<String, List<MarkerPair>> result = analyzeFiles(files); AnalyzerResult analyzerResult = new AnalyzerResult(result); return analyzerResult; }  AnalyzerResult analyze(List<String> filePaths); }
Analyzer { public AnalyzerResult analyze(List<String> filePaths) throws FileNotFoundException { if (filePaths == null || filePaths.isEmpty()) { return null; } List<File> files = new LinkedList<>(); for (String filePath : filePaths) { File file = new File(filePath); if (file.exists()) { files.add(file); } else { throw new FileNotFoundException("File not found: " + filePath); } } Map<String, List<MarkerPair>> result = analyzeFiles(files); AnalyzerResult analyzerResult = new AnalyzerResult(result); return analyzerResult; }  AnalyzerResult analyze(List<String> filePaths);  }