Search in sources :

Example 1 with NTBoolean

use of org.neo4j.internal.kernel.api.procs.Neo4jTypes.NTBoolean in project neo4j by neo4j.

the class ProcedureCompilationTest method shouldHandleNulls.

@Test
void shouldHandleNulls() throws ProcedureException {
    // Given
    UserFunctionSignature signature = functionSignature("test", "foo").in("b", NTBoolean).out(NTFloat).build();
    // When
    CallableUserFunction nullyMethod = compileFunction(signature, emptyList(), method("nullyMethod", Boolean.class));
    // Then
    assertEquals(Values.NO_VALUE, nullyMethod.apply(ctx, new AnyValue[] { TRUE }));
    assertEquals(PI, nullyMethod.apply(ctx, new AnyValue[] { Values.NO_VALUE }));
}
Also used : CallableUserFunction(org.neo4j.kernel.api.procedure.CallableUserFunction) AnyValue(org.neo4j.values.AnyValue) UserFunctionSignature(org.neo4j.internal.kernel.api.procs.UserFunctionSignature) NTBoolean(org.neo4j.internal.kernel.api.procs.Neo4jTypes.NTBoolean) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 NTBoolean (org.neo4j.internal.kernel.api.procs.Neo4jTypes.NTBoolean)1 UserFunctionSignature (org.neo4j.internal.kernel.api.procs.UserFunctionSignature)1 CallableUserFunction (org.neo4j.kernel.api.procedure.CallableUserFunction)1 AnyValue (org.neo4j.values.AnyValue)1