@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 { String sourceCode = contentReader.readFileForRegex(filepath); Pattern pattern = Pattern.compile(".*\\s*class\\s+.*"); Matcher classSignatures = pattern.matcher(sourceCode); int classCounter = 0; while (classSignatures.find()) { classCounter++; } return classCounter; }
RegexAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOC(String filepath) throws IOException { String sourceCode = contentReader.readFileForRegex(filepath); Pattern pattern = Pattern.compile(".*\\s*class\\s+.*"); Matcher classSignatures = pattern.matcher(sourceCode); int classCounter = 0; while (classSignatures.find()) { classCounter++; } return classCounter; } }
RegexAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOC(String filepath) throws IOException { String sourceCode = contentReader.readFileForRegex(filepath); Pattern pattern = Pattern.compile(".*\\s*class\\s+.*"); Matcher classSignatures = pattern.matcher(sourceCode); int classCounter = 0; while (classSignatures.find()) { classCounter++; } return classCounter; }  }
RegexAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOC(String filepath) throws IOException { String sourceCode = contentReader.readFileForRegex(filepath); Pattern pattern = Pattern.compile(".*\\s*class\\s+.*"); Matcher classSignatures = pattern.matcher(sourceCode); int classCounter = 0; while (classSignatures.find()) { classCounter++; } return classCounter; }  @Override int calculateLOC(String filepath); @Override int calculateNOM(String filepath); @Override int calculateNOC(String filepath); }
RegexAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOC(String filepath) throws IOException { String sourceCode = contentReader.readFileForRegex(filepath); Pattern pattern = Pattern.compile(".*\\s*class\\s+.*"); Matcher classSignatures = pattern.matcher(sourceCode); int classCounter = 0; while (classSignatures.find()) { classCounter++; } return classCounter; }  @Override int calculateLOC(String filepath); @Override int calculateNOM(String filepath); @Override int calculateNOC(String filepath);  }