### Question:
MetricVisitor extends TreeVisitor<InputFileContext> { public int numberOfFunctions() { return numberOfFunctions; } MetricVisitor(FileLinesContextFactory fileLinesContextFactory, NoSonarFilter noSonarFilter); static boolean isNosonarComment(Comment comment); Set<Integer> linesOfCode(); Set<Integer> commentLines(); Set<Integer> nosonarLines(); Set<Integer> executableLines(); int numberOfFunctions(); int numberOfClasses(); int cognitiveComplexity(); static final String NOSONAR_PREFIX; }### Answer:
@Test public void functions() throws Exception { scan("" + "x + 1;\n" + "x = true || false;"); assertThat(visitor.numberOfFunctions()).isEqualTo(0); scan("" + "x + 1;\n" + "fun noBodyFunction();\n" + "fun() { x = 1; }\n" + "fun function1() { "x = true || false; }"); assertThat(visitor.numberOfFunctions()).isEqualTo(1); }