use of javax.lang.model.element.Element in project neo4j by neo4j.
the class UserFunctionVisitorTest method functions_with_unsupported_return_types_are_invalid.
@Test
public void functions_with_unsupported_return_types_are_invalid() {
Element function = elementTestUtils.findMethodElement(UserFunctionsExamples.class, "wrongReturnType");
Stream<CompilationMessage> errors = visitor.visit(function);
assertThat(errors).hasSize(1).extracting(CompilationMessage::getCategory, CompilationMessage::getElement, CompilationMessage::getContents).contains(tuple(Diagnostic.Kind.ERROR, function, "Unsupported return type <void> of function defined in <org.neo4j.tooling.procedure.visitors.examples.UserFunctionsExamples#wrongReturnType>."));
}
use of javax.lang.model.element.Element in project neo4j by neo4j.
the class UserFunctionVisitorTest method functions_with_non_annotated_parameters_are_invalid.
@Test
public void functions_with_non_annotated_parameters_are_invalid() {
Element function = elementTestUtils.findMethodElement(UserFunctionsExamples.class, "missingParameterAnnotation");
Stream<CompilationMessage> errors = visitor.visit(function);
assertThat(errors).hasSize(1).extracting(CompilationMessage::getCategory, CompilationMessage::getContents).contains(tuple(Diagnostic.Kind.ERROR, "@org.neo4j.procedure.Name usage error: missing on parameter <arg1>"));
}
use of javax.lang.model.element.Element in project neo4j by neo4j.
the class UserFunctionVisitorTest method functions_in_non_root_namespace_are_valid.
@Test
public void functions_in_non_root_namespace_are_valid() {
Element function = elementTestUtils.findMethodElement(UserFunctionsExamples.class, "ok");
Stream<CompilationMessage> errors = visitor.visit(function);
assertThat(errors).isEmpty();
}
use of javax.lang.model.element.Element in project neo4j by neo4j.
the class DuplicatedProcedureValidatorTest method procedureMethod.
private Element procedureMethod(String name) {
TypeElement typeElement = elements.getTypeElement(name);
Collection<Element> procedures = findProcedures(typeElement);
if (procedures.size() != 1) {
throw new AssertionError("Test procedure class should only have 1 defined procedure");
}
return procedures.iterator().next();
}
use of javax.lang.model.element.Element in project neo4j by neo4j.
the class PerformsWriteMethodVisitorTest method validates_regular_procedure.
@Test
public void validates_regular_procedure() {
Element element = elementTestUtils.findMethodElement(PerformsWriteProcedures.class, "ok");
Stream<CompilationMessage> errors = visitor.visit(element);
assertThat(errors).isEmpty();
}
Aggregations