Search in sources :

Example 21 with DefaultParameterValue

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

the class ListConverterTest method shouldHandleBooleanValues.

@Test
void shouldHandleBooleanValues() {
    // Given
    ListConverter converter = new ListConverter(Boolean.class, NTBoolean, expressionEvaluator());
    String mapString = "[false, true]";
    // When
    DefaultParameterValue converted = converter.apply(mapString);
    // Then
    assertThat(converted).isEqualTo(ntList(asList(false, true), NTBoolean));
}
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 22 with DefaultParameterValue

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

the class ListConverterTest method shouldPassOnValidMixedTypes.

@Test
void shouldPassOnValidMixedTypes() {
    // Given
    ListConverter converter = new ListConverter(Object.class, NTAny, expressionEvaluator());
    String listString = "[1337, 'forty-two']";
    // When
    DefaultParameterValue value = converter.apply(listString);
    // Then
    assertThat(value).isEqualTo(ntList(asList(1337L, "forty-two"), NTAny));
}
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 23 with DefaultParameterValue

use of org.neo4j.internal.kernel.api.procs.DefaultParameterValue 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 24 with DefaultParameterValue

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

the class ListConverterTest method shouldHandleNullValue.

@Test
void shouldHandleNullValue() {
    // Given
    ListConverter converter = new ListConverter(Double.class, NTFloat, expressionEvaluator());
    String listString = "[null]";
    // When
    DefaultParameterValue converted = converter.apply(listString);
    // Then
    assertThat(converted).isEqualTo(ntList(singletonList(null), NTFloat));
}
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 25 with DefaultParameterValue

use of org.neo4j.internal.kernel.api.procs.DefaultParameterValue 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)

Aggregations

DefaultParameterValue (org.neo4j.internal.kernel.api.procs.DefaultParameterValue)31 Test (org.junit.jupiter.api.Test)30 NTString (org.neo4j.internal.kernel.api.procs.Neo4jTypes.NTString)12 Arrays.asList (java.util.Arrays.asList)2 Collections.emptyList (java.util.Collections.emptyList)2 Collections.emptyMap (java.util.Collections.emptyMap)2 Collections.singletonList (java.util.Collections.singletonList)2 List (java.util.List)2 Map (java.util.Map)2 DefaultParameterValue.ntList (org.neo4j.internal.kernel.api.procs.DefaultParameterValue.ntList)2 DefaultParameterValue.ntMap (org.neo4j.internal.kernel.api.procs.DefaultParameterValue.ntMap)2 NTList (org.neo4j.internal.kernel.api.procs.Neo4jTypes.NTList)2 Parameter (java.lang.reflect.Parameter)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 Type (java.lang.reflect.Type)1 ArrayList (java.util.ArrayList)1 ProcedureException (org.neo4j.internal.kernel.api.exceptions.ProcedureException)1 FieldSignature (org.neo4j.internal.kernel.api.procs.FieldSignature)1 Name (org.neo4j.procedure.Name)1 DefaultValueConverter (org.neo4j.procedure.impl.TypeCheckers.DefaultValueConverter)1