Search in sources :

Example 6 with NTString

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

the class ListConverterTest method shouldHandleSingleQuotedValue.

@Test
void shouldHandleSingleQuotedValue() {
    // Given
    ListConverter converter = new ListConverter(String.class, NTString, expressionEvaluator());
    String listString = "['foo', 'bar']";
    // When
    DefaultParameterValue converted = converter.apply(listString);
    // Then
    assertThat(converted).isEqualTo(ntList(asList("foo", "bar"), NTString));
}
Also used : DefaultParameterValue(org.neo4j.internal.kernel.api.procs.DefaultParameterValue) NTString(org.neo4j.internal.kernel.api.procs.Neo4jTypes.NTString) Test(org.junit.jupiter.api.Test)

Example 7 with NTString

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

the class ListConverterTest method shouldHandleDoubleQuotedValue.

@Test
void shouldHandleDoubleQuotedValue() {
    // Given
    ListConverter converter = new ListConverter(String.class, NTString, expressionEvaluator());
    String listString = "[\"foo\", \"bar\"]";
    // When
    DefaultParameterValue converted = converter.apply(listString);
    // Then
    assertThat(converted).isEqualTo(ntList(asList("foo", "bar"), NTString));
}
Also used : DefaultParameterValue(org.neo4j.internal.kernel.api.procs.DefaultParameterValue) NTString(org.neo4j.internal.kernel.api.procs.Neo4jTypes.NTString) Test(org.junit.jupiter.api.Test)

Example 8 with NTString

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

the class ListConverterTest method shouldHandleNullString.

@Test
void shouldHandleNullString() {
    // Given
    ListConverter converter = new ListConverter(String.class, NTString, expressionEvaluator());
    String listString = "null";
    // When
    DefaultParameterValue converted = converter.apply(listString);
    // Then
    assertThat(converted).isEqualTo(ntList(null, NTString));
}
Also used : DefaultParameterValue(org.neo4j.internal.kernel.api.procs.DefaultParameterValue) NTString(org.neo4j.internal.kernel.api.procs.Neo4jTypes.NTString) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)8 NTString (org.neo4j.internal.kernel.api.procs.Neo4jTypes.NTString)8 DefaultParameterValue (org.neo4j.internal.kernel.api.procs.DefaultParameterValue)5 UserFunctionSignature (org.neo4j.internal.kernel.api.procs.UserFunctionSignature)2 Context (org.neo4j.kernel.api.procedure.Context)2 Method (java.lang.reflect.Method)1 ProcedureSignature (org.neo4j.internal.kernel.api.procs.ProcedureSignature)1 UserAggregator (org.neo4j.internal.kernel.api.procs.UserAggregator)1 CallableUserFunction (org.neo4j.kernel.api.procedure.CallableUserFunction)1 AnyValue (org.neo4j.values.AnyValue)1