@Test public void testCalculateNOM() throws IOException { int expectedNom = 3; int actualNom = analyzer.calculateNOM(TEST_FILEPATH); assertEquals(expectedNom, actualNom); }
@Override public int calculateNOM(String filepath) throws IOException { String sourceCode = contentReader.readFileForRegex(filepath); Pattern pattern = Pattern.compile( ".*(public |protected |private |static )?[\\w\\<\\>\\[\\]]+\\s+(\\w+) *\\([^\\)]*\\) *(\\{?|[^;]).*"); Matcher methodSignatures = pattern.matcher(sourceCode); int methodCounter = 0; while (methodSignatures.find()) { methodCounter++; } return methodCounter; }
RegexAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOM(String filepath) throws IOException { String sourceCode = contentReader.readFileForRegex(filepath); Pattern pattern = Pattern.compile( ".*(public |protected |private |static )?[\\w\\<\\>\\[\\]]+\\s+(\\w+) *\\([^\\)]*\\) *(\\{?|[^;]).*"); Matcher methodSignatures = pattern.matcher(sourceCode); int methodCounter = 0; while (methodSignatures.find()) { methodCounter++; } return methodCounter; } }
RegexAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOM(String filepath) throws IOException { String sourceCode = contentReader.readFileForRegex(filepath); Pattern pattern = Pattern.compile( ".*(public |protected |private |static )?[\\w\\<\\>\\[\\]]+\\s+(\\w+) *\\([^\\)]*\\) *(\\{?|[^;]).*"); Matcher methodSignatures = pattern.matcher(sourceCode); int methodCounter = 0; while (methodSignatures.find()) { methodCounter++; } return methodCounter; }  }
RegexAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOM(String filepath) throws IOException { String sourceCode = contentReader.readFileForRegex(filepath); Pattern pattern = Pattern.compile( ".*(public |protected |private |static )?[\\w\\<\\>\\[\\]]+\\s+(\\w+) *\\([^\\)]*\\) *(\\{?|[^;]).*"); Matcher methodSignatures = pattern.matcher(sourceCode); int methodCounter = 0; while (methodSignatures.find()) { methodCounter++; } return methodCounter; }  @Override int calculateLOC(String filepath); @Override int calculateNOM(String filepath); @Override int calculateNOC(String filepath); }
RegexAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOM(String filepath) throws IOException { String sourceCode = contentReader.readFileForRegex(filepath); Pattern pattern = Pattern.compile( ".*(public |protected |private |static )?[\\w\\<\\>\\[\\]]+\\s+(\\w+) *\\([^\\)]*\\) *(\\{?|[^;]).*"); Matcher methodSignatures = pattern.matcher(sourceCode); int methodCounter = 0; while (methodSignatures.find()) { methodCounter++; } return methodCounter; }  @Override int calculateLOC(String filepath); @Override int calculateNOM(String filepath); @Override int calculateNOC(String filepath);  }