@Test public void testReferencingConstant() throws IOException, ParseException { File file = new File("src/test/java/controller/ControllerReferencingConstant.java"); final CompilationUnit declaration = JavaParser.parse(file); ControllerModel model = new ControllerModel(); visitor.visit(declaration, model); final Collection<ControllerRouteModel> routes = (Collection<ControllerRouteModel>) model.getRoutes().get("/constant"); assertThat(routes).isNotNull(); assertThat(routes).hasSize(3); for (ControllerRouteModel route : routes) { assertThat(route.getHttpMethod().name()).isEqualToIgnoringCase(route.getMethodName()); assertThat(route.getParams()).isEmpty(); assertThat(route.getPath()).isEqualToIgnoringCase("/constant"); } }
@Override public void visit(ClassOrInterfaceDeclaration declaration, ControllerModel controller) { controller.setName(declaration.getName()); LOGGER.info("[controller]Visit " + controller.getName()); super.visit(declaration,controller); }
ControllerSourceVisitor extends VoidVisitorAdapter<ControllerModel> implements NameConstant { @Override public void visit(ClassOrInterfaceDeclaration declaration, ControllerModel controller) { controller.setName(declaration.getName()); LOGGER.info("[controller]Visit " + controller.getName()); super.visit(declaration,controller); } }
ControllerSourceVisitor extends VoidVisitorAdapter<ControllerModel> implements NameConstant { @Override public void visit(ClassOrInterfaceDeclaration declaration, ControllerModel controller) { controller.setName(declaration.getName()); LOGGER.info("[controller]Visit " + controller.getName()); super.visit(declaration,controller); }  }
ControllerSourceVisitor extends VoidVisitorAdapter<ControllerModel> implements NameConstant { @Override public void visit(ClassOrInterfaceDeclaration declaration, ControllerModel controller) { controller.setName(declaration.getName()); LOGGER.info("[controller]Visit " + controller.getName()); super.visit(declaration,controller); }  @Override void visit(ClassOrInterfaceDeclaration declaration, ControllerModel controller); @Override void visit(NormalAnnotationExpr anno, ControllerModel controller); @Override void visit(InitializerDeclaration n, ControllerModel arg); @Override void visit(FieldDeclaration n, ControllerModel arg); @Override void visit(FieldAccessExpr n, ControllerModel arg); @Override void visit(SingleMemberAnnotationExpr anno, ControllerModel controller); @Override void visit(JavadocComment jdoc, ControllerModel controller); @Override void visit(MethodDeclaration method, ControllerModel controller); }
ControllerSourceVisitor extends VoidVisitorAdapter<ControllerModel> implements NameConstant { @Override public void visit(ClassOrInterfaceDeclaration declaration, ControllerModel controller) { controller.setName(declaration.getName()); LOGGER.info("[controller]Visit " + controller.getName()); super.visit(declaration,controller); }  @Override void visit(ClassOrInterfaceDeclaration declaration, ControllerModel controller); @Override void visit(NormalAnnotationExpr anno, ControllerModel controller); @Override void visit(InitializerDeclaration n, ControllerModel arg); @Override void visit(FieldDeclaration n, ControllerModel arg); @Override void visit(FieldAccessExpr n, ControllerModel arg); @Override void visit(SingleMemberAnnotationExpr anno, ControllerModel controller); @Override void visit(JavadocComment jdoc, ControllerModel controller); @Override void visit(MethodDeclaration method, ControllerModel controller);  }