@Test public void testPerformFileAnalysisWithoutInjectingDependencies() throws IOException { File outputFile = new File(OUTPUT_FILE + ".csv"); if(outputFile.exists()) outputFile.delete(); SourceCodeAnalyzerFacade codeAnalyzer = new SourceCodeAnalyzerFacade(); try { codeAnalyzer.performFileAnalysis( TEST_CLASS_LOCAL, ANALYSIS_TYPE, FILE_LOCATION_TYPE, OUTPUT_FILE, EXPORT_TYPE); assertTrue(outputFile.exists()); String[] expectedContent = {"loc,noc,nom,", "21,3,3,"}; String[] actualContent = readTestFileContentIntoList(outputFile.getAbsolutePath()); assertArrayEquals(expectedContent, actualContent); } finally { outputFile.delete(); } }
public void performFileAnalysis(String filepath, String analysisType, String fileLocation, String outputFileName, String outputFileType) throws IOException { ContentReader contentReader = readerFactory.createContentReader(fileLocation); SourceCodeAnalyzer analyzer = analyzerFactory.createSourceCodeAnalyzer(analysisType); analyzer.setContentReader(contentReader); int loc = analyzer.calculateLOC(filepath); int nom = analyzer.calculateNOM(filepath); int noc = analyzer.calculateNOC(filepath); Map<String,Integer> metrics = new HashMap<>(); metrics.put("loc", loc); metrics.put("nom", nom); metrics.put("noc", noc); MetricsExporter metricsExporter = exporterFactory.createMetricsExporter(outputFileType); metricsExporter.writeToFile(outputFileName, metrics); }
SourceCodeAnalyzerFacade { public void performFileAnalysis(String filepath, String analysisType, String fileLocation, String outputFileName, String outputFileType) throws IOException { ContentReader contentReader = readerFactory.createContentReader(fileLocation); SourceCodeAnalyzer analyzer = analyzerFactory.createSourceCodeAnalyzer(analysisType); analyzer.setContentReader(contentReader); int loc = analyzer.calculateLOC(filepath); int nom = analyzer.calculateNOM(filepath); int noc = analyzer.calculateNOC(filepath); Map<String,Integer> metrics = new HashMap<>(); metrics.put("loc", loc); metrics.put("nom", nom); metrics.put("noc", noc); MetricsExporter metricsExporter = exporterFactory.createMetricsExporter(outputFileType); metricsExporter.writeToFile(outputFileName, metrics); } }
SourceCodeAnalyzerFacade { public void performFileAnalysis(String filepath, String analysisType, String fileLocation, String outputFileName, String outputFileType) throws IOException { ContentReader contentReader = readerFactory.createContentReader(fileLocation); SourceCodeAnalyzer analyzer = analyzerFactory.createSourceCodeAnalyzer(analysisType); analyzer.setContentReader(contentReader); int loc = analyzer.calculateLOC(filepath); int nom = analyzer.calculateNOM(filepath); int noc = analyzer.calculateNOC(filepath); Map<String,Integer> metrics = new HashMap<>(); metrics.put("loc", loc); metrics.put("nom", nom); metrics.put("noc", noc); MetricsExporter metricsExporter = exporterFactory.createMetricsExporter(outputFileType); metricsExporter.writeToFile(outputFileName, metrics); } SourceCodeAnalyzerFacade();  SourceCodeAnalyzerFacade(ContentReaderFactory readerFactory, SourceCodeAnalyzerFactory analyzerFactory,
			MetricsExporterFactory exporterFactory); }
SourceCodeAnalyzerFacade { public void performFileAnalysis(String filepath, String analysisType, String fileLocation, String outputFileName, String outputFileType) throws IOException { ContentReader contentReader = readerFactory.createContentReader(fileLocation); SourceCodeAnalyzer analyzer = analyzerFactory.createSourceCodeAnalyzer(analysisType); analyzer.setContentReader(contentReader); int loc = analyzer.calculateLOC(filepath); int nom = analyzer.calculateNOM(filepath); int noc = analyzer.calculateNOC(filepath); Map<String,Integer> metrics = new HashMap<>(); metrics.put("loc", loc); metrics.put("nom", nom); metrics.put("noc", noc); MetricsExporter metricsExporter = exporterFactory.createMetricsExporter(outputFileType); metricsExporter.writeToFile(outputFileName, metrics); } SourceCodeAnalyzerFacade();  SourceCodeAnalyzerFacade(ContentReaderFactory readerFactory, SourceCodeAnalyzerFactory analyzerFactory,
			MetricsExporterFactory exporterFactory); void performFileAnalysis(String filepath, String analysisType, String fileLocation, String outputFileName, String outputFileType); }
SourceCodeAnalyzerFacade { public void performFileAnalysis(String filepath, String analysisType, String fileLocation, String outputFileName, String outputFileType) throws IOException { ContentReader contentReader = readerFactory.createContentReader(fileLocation); SourceCodeAnalyzer analyzer = analyzerFactory.createSourceCodeAnalyzer(analysisType); analyzer.setContentReader(contentReader); int loc = analyzer.calculateLOC(filepath); int nom = analyzer.calculateNOM(filepath); int noc = analyzer.calculateNOC(filepath); Map<String,Integer> metrics = new HashMap<>(); metrics.put("loc", loc); metrics.put("nom", nom); metrics.put("noc", noc); MetricsExporter metricsExporter = exporterFactory.createMetricsExporter(outputFileType); metricsExporter.writeToFile(outputFileName, metrics); } SourceCodeAnalyzerFacade();  SourceCodeAnalyzerFacade(ContentReaderFactory readerFactory, SourceCodeAnalyzerFactory analyzerFactory,
			MetricsExporterFactory exporterFactory); void performFileAnalysis(String filepath, String analysisType, String fileLocation, String outputFileName, String outputFileType);  }