@Test public void testCalculateNOC() throws IOException { int expectedNoc = 3; int actualNoc = analyzer.calculateNOC(TEST_FILEPATH); assertEquals(expectedNoc, actualNoc); }
@Override public int calculateNOC(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int classCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if ((line.startsWith("class ") || line.contains(" class ")) && line.contains("{")) { classCounter++; } } return classCounter; }
StringComparisonAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOC(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int classCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if ((line.startsWith("class ") || line.contains(" class ")) && line.contains("{")) { classCounter++; } } return classCounter; } }
StringComparisonAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOC(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int classCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if ((line.startsWith("class ") || line.contains(" class ")) && line.contains("{")) { classCounter++; } } return classCounter; }  }
StringComparisonAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOC(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int classCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if ((line.startsWith("class ") || line.contains(" class ")) && line.contains("{")) { classCounter++; } } return classCounter; }  @Override int calculateLOC(String filepath); @Override int calculateNOM(String filepath); @Override int calculateNOC(String filepath); }
StringComparisonAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOC(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int classCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if ((line.startsWith("class ") || line.contains(" class ")) && line.contains("{")) { classCounter++; } } return classCounter; }  @Override int calculateLOC(String filepath); @Override int calculateNOM(String filepath); @Override int calculateNOC(String filepath);  }