Search in sources :

Example 1 with DefaultParameterValue

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

the class MapConverterTest method shouldHandleSingleQuotedValue.

@Test
void shouldHandleSingleQuotedValue() {
    // Given
    String mapString = "{key: 'value'}";
    // When
    DefaultParameterValue converted = converter.apply(mapString);
    // Then
    assertThat(converted).isEqualTo(ntMap(map("key", "value")));
}
Also used : DefaultParameterValue(org.neo4j.internal.kernel.api.procs.DefaultParameterValue) Test(org.junit.jupiter.api.Test)

Example 2 with DefaultParameterValue

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

the class MapConverterTest method shouldHandleDoubleQuotedValue.

@Test
void shouldHandleDoubleQuotedValue() {
    // Given
    String mapString = "{key: \"value\"}";
    // When
    DefaultParameterValue converted = converter.apply(mapString);
    // Then
    assertThat(converted).isEqualTo(ntMap(map("key", "value")));
}
Also used : DefaultParameterValue(org.neo4j.internal.kernel.api.procs.DefaultParameterValue) Test(org.junit.jupiter.api.Test)

Example 3 with DefaultParameterValue

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

the class MapConverterTest method shouldHandleNullString.

@Test
void shouldHandleNullString() {
    // Given
    String mapString = "null";
    // When
    DefaultParameterValue converted = converter.apply(mapString);
    // Then
    assertThat(converted).isEqualTo(ntMap(null));
}
Also used : DefaultParameterValue(org.neo4j.internal.kernel.api.procs.DefaultParameterValue) Test(org.junit.jupiter.api.Test)

Example 4 with DefaultParameterValue

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

the class ListConverterTest method shouldHandleFloatValue.

@Test
void shouldHandleFloatValue() {
    // Given
    ListConverter converter = new ListConverter(Double.class, NTFloat, expressionEvaluator());
    String listSting = "[2.718281828, 3.14]";
    // When
    DefaultParameterValue converted = converter.apply(listSting);
    // Then
    assertThat(converted).isEqualTo(ntList(asList(2.718281828, 3.14), 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 5 with DefaultParameterValue

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

the class ListConverterTest method shouldHandleEmptyListWithSpaces.

@Test
void shouldHandleEmptyListWithSpaces() {
    // Given
    ListConverter converter = new ListConverter(String.class, NTString, expressionEvaluator());
    String listString = " [  ]   ";
    // When
    DefaultParameterValue converted = converter.apply(listString);
    // Then
    assertThat(converted).isEqualTo(ntList(emptyList(), 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