use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class UserAggregationFunctionTest method shouldNotAllowNonPublicUpdateMethod.
@Test
void shouldNotAllowNonPublicUpdateMethod() {
ProcedureException exception = assertThrows(ProcedureException.class, () -> compile(NonPublicUpdateMethod.class));
assertThat(exception.getMessage()).isEqualTo("Aggregation update method 'update' in InnerAggregator must be public.");
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class UserAggregationFunctionTest method shouldGiveHelpfulErrorOnNullMessageException.
@Test
void shouldGiveHelpfulErrorOnNullMessageException() throws Throwable {
// Given
CallableUserAggregationFunction method = compile(FunctionThatThrowsNullMsgExceptionAtInvocation.class).get(0);
ProcedureException exception = assertThrows(ProcedureException.class, () -> method.create(prepareContext()).update(new AnyValue[] {}));
assertThat(exception.getMessage()).isEqualTo("Failed to invoke function `org.neo4j.procedure.impl.test`: Caused by: java.lang.IndexOutOfBoundsException");
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class UserAggregationFunctionTest method shouldGiveHelpfulErrorOnFunctionReturningInvalidType.
@Test
void shouldGiveHelpfulErrorOnFunctionReturningInvalidType() {
ProcedureException exception = assertThrows(ProcedureException.class, () -> compile(FunctionWithInvalidOutput.class));
assertThat(exception.getMessage()).isEqualTo(String.format("Don't know how to map `char[]` to the Neo4j Type System.%n" + "Please refer to to the documentation for full details.%n" + "For your reference, known types are: [boolean, byte[], double, java.lang.Boolean, " + "java.lang.Double, java.lang.Long, java.lang.Number, java.lang.Object, " + "java.lang.String, java.time.LocalDate, java.time.LocalDateTime, " + "java.time.LocalTime, java.time.OffsetTime, java.time.ZonedDateTime, " + "java.time.temporal.TemporalAmount, java.util.List, java.util.Map, long]"));
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class UserAggregationFunctionTest method shouldGiveHelpfulErrorOnContextAnnotatedStaticField.
@Test
void shouldGiveHelpfulErrorOnContextAnnotatedStaticField() {
ProcedureException exception = assertThrows(ProcedureException.class, () -> compile(FunctionWithStaticContextAnnotatedField.class));
assertThat(exception.getMessage()).isEqualTo(String.format("The field `gdb` in the class named `FunctionWithStaticContextAnnotatedField` is annotated as a @Context field,%n" + "but it is static. @Context fields must be public, non-final and non-static,%n" + "because they are reset each time a procedure is invoked."));
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class UserAggregationFunctionTest method shouldNotAllowMissingAnnotations.
@Test
void shouldNotAllowMissingAnnotations() {
ProcedureException exception = assertThrows(ProcedureException.class, () -> compile(FunctionWithMissingAnnotations.class));
assertThat(exception.getMessage()).isEqualTo("Class 'MissingAggregator' must contain methods annotated with both '@UserAggregationResult' as well as '@UserAggregationUpdate'.");
}
Aggregations