@Test public void testCalculateLOC() throws IOException { int expectedLoc = 7; int actualLoc = analyzer.calculateLOC(TEST_FILEPATH); assertEquals(expectedLoc, actualLoc); }
@Override public int calculateLOC(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int nonCodeLinesCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if (line.startsWith(" || line.equals("}") || line.equals("")) nonCodeLinesCounter++; } int loc = sourceCodeList.size() - nonCodeLinesCounter; return loc; }
StringComparisonAnalyzer extends SourceCodeAnalyzer { @Override public int calculateLOC(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int nonCodeLinesCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if (line.startsWith(" || line.equals("}") || line.equals("")) nonCodeLinesCounter++; } int loc = sourceCodeList.size() - nonCodeLinesCounter; return loc; } }
StringComparisonAnalyzer extends SourceCodeAnalyzer { @Override public int calculateLOC(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int nonCodeLinesCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if (line.startsWith(" || line.equals("}") || line.equals("")) nonCodeLinesCounter++; } int loc = sourceCodeList.size() - nonCodeLinesCounter; return loc; }  }
StringComparisonAnalyzer extends SourceCodeAnalyzer { @Override public int calculateLOC(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int nonCodeLinesCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if (line.startsWith(" || line.equals("}") || line.equals("")) nonCodeLinesCounter++; } int loc = sourceCodeList.size() - nonCodeLinesCounter; return loc; }  @Override int calculateLOC(String filepath); @Override int calculateNOM(String filepath); @Override int calculateNOC(String filepath); }
StringComparisonAnalyzer extends SourceCodeAnalyzer { @Override public int calculateLOC(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int nonCodeLinesCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if (line.startsWith(" || line.equals("}") || line.equals("")) nonCodeLinesCounter++; } int loc = sourceCodeList.size() - nonCodeLinesCounter; return loc; }  @Override int calculateLOC(String filepath); @Override int calculateNOM(String filepath); @Override int calculateNOC(String filepath);  }