use of org.neo4j.internal.kernel.api.procs.DefaultParameterValue in project neo4j by neo4j.
the class ListConverterTest method shouldHandleIntegerValue.
@Test
void shouldHandleIntegerValue() {
// Given
ListConverter converter = new ListConverter(Long.class, NTInteger, expressionEvaluator());
String listString = "[1337, 42]";
// When
DefaultParameterValue converted = converter.apply(listString);
// Then
assertThat(converted).isEqualTo(ntList(asList(1337L, 42L), NTInteger));
}
use of org.neo4j.internal.kernel.api.procs.DefaultParameterValue in project neo4j by neo4j.
the class ListConverterTest method shouldHandleListsOfMaps.
@SuppressWarnings("unchecked")
@Test
void shouldHandleListsOfMaps() {
// Given
ListConverter converter = new ListConverter(Map.class, NTMap, expressionEvaluator());
String mapString = "[{k1: 42}, {k1: 1337}]";
// When
DefaultParameterValue converted = converter.apply(mapString);
// Then
List<Object> list = (List<Object>) converted.value();
assertThat(list.get(0)).isEqualTo(map("k1", 42L));
assertThat(list.get(1)).isEqualTo(map("k1", 1337L));
}
use of org.neo4j.internal.kernel.api.procs.DefaultParameterValue in project neo4j by neo4j.
the class ListConverterTest method shouldHandleNestedLists.
@SuppressWarnings("unchecked")
@Test
void shouldHandleNestedLists() {
// Given
ParameterizedType type = mock(ParameterizedType.class);
when(type.getActualTypeArguments()).thenReturn(new Type[] { Object.class });
ListConverter converter = new ListConverter(type, NTList(NTAny), expressionEvaluator());
String mapString = "[42, [42, 1337]]";
// When
DefaultParameterValue converted = converter.apply(mapString);
// Then
List<Object> list = (List<Object>) converted.value();
assertThat(list.get(0)).isEqualTo(42L);
assertThat(list.get(1)).isEqualTo(asList(42L, 1337L));
}
use of org.neo4j.internal.kernel.api.procs.DefaultParameterValue in project neo4j by neo4j.
the class ListConverterTest method shouldHandleEmptyList.
@Test
void shouldHandleEmptyList() {
// Given
ListConverter converter = new ListConverter(String.class, NTString, expressionEvaluator());
String listString = "[]";
// When
DefaultParameterValue converted = converter.apply(listString);
// Then
assertThat(converted).isEqualTo(ntList(emptyList(), NTString));
}
use of org.neo4j.internal.kernel.api.procs.DefaultParameterValue in project neo4j by neo4j.
the class MapConverterTest method shouldHandleNullValue.
@Test
void shouldHandleNullValue() {
// Given
String mapString = "{key: null}";
// When
DefaultParameterValue converted = converter.apply(mapString);
// Then
assertThat(converted).isEqualTo(ntMap(map("key", null)));
}
Aggregations