use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class ResourceInjectionTest method shouldFailNicelyWhenAggregationFunctionUsesUnknownAPI.
@Test
void shouldFailNicelyWhenAggregationFunctionUsesUnknownAPI() {
ProcedureException exception = assertThrows(ProcedureException.class, () -> compiler.compileAggregationFunction(AggregationFunctionWithUnknownAPI.class));
assertThat(exception.getMessage()).isEqualTo("Unable to set up injection for procedure `AggregationFunctionWithUnknownAPI`, " + "the field `api` has type `class org.neo4j.procedure.impl.ResourceInjectionTest$UnknownAPI` which is not a known injectable component.");
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class ResourceInjectionTest method shouldFailNicelyWhenUnknownAPI.
@Test
void shouldFailNicelyWhenUnknownAPI() {
ProcedureException exception = assertThrows(ProcedureException.class, () -> compiler.compileProcedure(ProcedureWithUnknownAPI.class, null, true));
assertThat(exception.getMessage()).isEqualTo("Unable to set up injection for procedure `ProcedureWithUnknownAPI`, " + "the field `api` has type `class org.neo4j.procedure.impl.ResourceInjectionTest$UnknownAPI` " + "which is not a known injectable component.");
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class ResourceInjectionTest method shouldFailNicelyWhenUnsafeAPISafeModeAggregationFunction.
@Test
void shouldFailNicelyWhenUnsafeAPISafeModeAggregationFunction() throws Throwable {
// When
List<CallableUserAggregationFunction> procList = compiler.compileAggregationFunction(AggregationFunctionWithUnsafeAPI.class);
assertThat(logProvider).forClass(getClass()).forLevel(WARN).containsMessages("org.neo4j.procedure.impl.listCoolPeople", "unavailable");
assertThat(procList.size()).isEqualTo(1);
ProcedureException exception = assertThrows(ProcedureException.class, () -> {
procList.get(0).create(prepareContext()).update(new AnyValue[] {});
procList.get(0).create(prepareContext()).result();
});
assertThat(exception.getMessage()).contains("org.neo4j.procedure.impl.listCoolPeople", "unavailable");
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class ResourceInjectionTest method shouldFailNicelyWhenFunctionUsesUnknownAPI.
@Test
void shouldFailNicelyWhenFunctionUsesUnknownAPI() {
ProcedureException exception = assertThrows(ProcedureException.class, () -> compiler.compileFunction(FunctionWithUnknownAPI.class, false));
assertThat(exception.getMessage()).isEqualTo("Unable to set up injection for procedure `FunctionWithUnknownAPI`, " + "the field `api` has type `class org.neo4j.procedure.impl.ResourceInjectionTest$UnknownAPI` which is not a known injectable component.");
}
use of org.neo4j.internal.kernel.api.exceptions.ProcedureException in project neo4j by neo4j.
the class UserAggregationFunctionTest method shouldGiveHelpfulErrorOnNoPublicConstructor.
@Test
void shouldGiveHelpfulErrorOnNoPublicConstructor() {
ProcedureException exception = assertThrows(ProcedureException.class, () -> compile(PrivateConstructorFunction.class));
assertThat(exception.getMessage()).isEqualTo("Unable to find a usable public no-argument constructor in the class `PrivateConstructorFunction`. Please add " + "a valid, public constructor, recompile the class and try again.");
}
Aggregations