@Test public void test_analyzeFiles__same_files() throws FileNotFoundException { File filePath = new File(path + "test_pair.txt"); File filePath2 = new File(path + "test_pair.txt"); List<File> filePaths = new LinkedList<>(); filePaths.add(filePath); filePaths.add(filePath2); List<MarkerPair> pairs = getMarkers(); Map<String, List<MarkerPair>> expectedResult = new HashMap<>(); expectedResult.put(filePath.getPath(), pairs); Map<String, List<MarkerPair>> actualResult = processor.analyzeFiles(filePaths); assertThat(actualResult, is(expectedResult)); }
protected Map<String, List<MarkerPair>> analyzeFiles(List<File> rootFiles) { Set<File> files = new HashSet<>(); for (File rootFile : rootFiles) { Set<File> filesUnderRoot = getFiles(rootFile, new HashSet<>()); files.addAll(filesUnderRoot); } Map<String, List<MarkerPair>> result = new HashMap<>(); for (File file : files) { try { LOG.debug("Analyzing: {}", file.getPath()); List<MarkerPair> markerPairs = fileProcessor.processFile(file); if (!markerPairs.isEmpty()) { result.put(file.getPath(), markerPairs); } } catch (FileNotFoundException e) { LOG.error("File not found:{}", file.getAbsolutePath(), e); } catch (IOException e) { LOG.error("Was not able to process file:{}", file.getAbsolutePath(), e); } } return result; }
Analyzer { protected Map<String, List<MarkerPair>> analyzeFiles(List<File> rootFiles) { Set<File> files = new HashSet<>(); for (File rootFile : rootFiles) { Set<File> filesUnderRoot = getFiles(rootFile, new HashSet<>()); files.addAll(filesUnderRoot); } Map<String, List<MarkerPair>> result = new HashMap<>(); for (File file : files) { try { LOG.debug("Analyzing: {}", file.getPath()); List<MarkerPair> markerPairs = fileProcessor.processFile(file); if (!markerPairs.isEmpty()) { result.put(file.getPath(), markerPairs); } } catch (FileNotFoundException e) { LOG.error("File not found:{}", file.getAbsolutePath(), e); } catch (IOException e) { LOG.error("Was not able to process file:{}", file.getAbsolutePath(), e); } } return result; } }
Analyzer { protected Map<String, List<MarkerPair>> analyzeFiles(List<File> rootFiles) { Set<File> files = new HashSet<>(); for (File rootFile : rootFiles) { Set<File> filesUnderRoot = getFiles(rootFile, new HashSet<>()); files.addAll(filesUnderRoot); } Map<String, List<MarkerPair>> result = new HashMap<>(); for (File file : files) { try { LOG.debug("Analyzing: {}", file.getPath()); List<MarkerPair> markerPairs = fileProcessor.processFile(file); if (!markerPairs.isEmpty()) { result.put(file.getPath(), markerPairs); } } catch (FileNotFoundException e) { LOG.error("File not found:{}", file.getAbsolutePath(), e); } catch (IOException e) { LOG.error("Was not able to process file:{}", file.getAbsolutePath(), e); } } return result; }  }
Analyzer { protected Map<String, List<MarkerPair>> analyzeFiles(List<File> rootFiles) { Set<File> files = new HashSet<>(); for (File rootFile : rootFiles) { Set<File> filesUnderRoot = getFiles(rootFile, new HashSet<>()); files.addAll(filesUnderRoot); } Map<String, List<MarkerPair>> result = new HashMap<>(); for (File file : files) { try { LOG.debug("Analyzing: {}", file.getPath()); List<MarkerPair> markerPairs = fileProcessor.processFile(file); if (!markerPairs.isEmpty()) { result.put(file.getPath(), markerPairs); } } catch (FileNotFoundException e) { LOG.error("File not found:{}", file.getAbsolutePath(), e); } catch (IOException e) { LOG.error("Was not able to process file:{}", file.getAbsolutePath(), e); } } return result; }  AnalyzerResult analyze(List<String> filePaths); }
Analyzer { protected Map<String, List<MarkerPair>> analyzeFiles(List<File> rootFiles) { Set<File> files = new HashSet<>(); for (File rootFile : rootFiles) { Set<File> filesUnderRoot = getFiles(rootFile, new HashSet<>()); files.addAll(filesUnderRoot); } Map<String, List<MarkerPair>> result = new HashMap<>(); for (File file : files) { try { LOG.debug("Analyzing: {}", file.getPath()); List<MarkerPair> markerPairs = fileProcessor.processFile(file); if (!markerPairs.isEmpty()) { result.put(file.getPath(), markerPairs); } } catch (FileNotFoundException e) { LOG.error("File not found:{}", file.getAbsolutePath(), e); } catch (IOException e) { LOG.error("Was not able to process file:{}", file.getAbsolutePath(), e); } } return result; }  AnalyzerResult analyze(List<String> filePaths);  }