### Question:
ClassSourceVisitor extends GenericVisitorAdapter<Boolean, Object> { public Boolean visit(final CompilationUnit n, final Object arg) { final Boolean result = super.visit(n, arg); return result != null && result; }  Boolean visit(final CompilationUnit n, final Object arg); Boolean visit(ClassOrInterfaceDeclaration declaration, Object extra);  }### Answer:
@Test public void testClassImplementingController() throws IOException, ParseException { File file = new File("src/test/java/sample/MyController.java"); final CompilationUnit declaration = JavaParser.parse(file); final Boolean isController = visitor.visit(declaration, null); assertThat(isController).isTrue(); }
@Test public void testClassExtendingDefaultController() throws IOException, ParseException { File file = new File("src/test/java/sample/MyDefaultController.java"); final CompilationUnit declaration = JavaParser.parse(file); final Boolean isController = visitor.visit(declaration, null); assertThat(isController).isTrue(); }
@Test public void testClassAnnotatedWithController() throws IOException, ParseException { File file = new File("src/test/java/sample/MyAnnotatedController.java"); final CompilationUnit declaration = JavaParser.parse(file); final Boolean isController = visitor.visit(declaration, null); assertThat(isController).isTrue(); }
@Test public void testABasicClass() throws IOException, ParseException { File file = new File("src/test/java/sample/MyClass.java"); final CompilationUnit declaration = JavaParser.parse(file); final Boolean isController = visitor.visit(declaration, null); assertThat(isController).isFalse(); }
@Test public void testAnInterfaceClass() throws IOException, ParseException { File file = new File("src/test/java/sample/MyInterface.java"); final CompilationUnit declaration = JavaParser.parse(file); final Boolean isController = visitor.visit(declaration, null); assertThat(isController).isFalse(); }
@Test public void testAnEnum() throws IOException, ParseException { File file = new File("src/test/java/sample/MyEnum.java"); final CompilationUnit declaration = JavaParser.parse(file); final Boolean isController = visitor.visit(declaration, null); assertThat(isController).isFalse(); }
@Test public void testAnAnnotation() throws IOException, ParseException { File file = new File("src/test/java/sample/MyAnnotation.java"); final CompilationUnit declaration = JavaParser.parse(file); final Boolean isController = visitor.visit(declaration, null); assertThat(isController).isFalse(); }