use of org.neo4j.internal.kernel.api.procs.DefaultParameterValue in project neo4j by neo4j.
the class MapConverterTest method shouldHandleNestedMaps.
@SuppressWarnings("unchecked")
@Test
void shouldHandleNestedMaps() {
// Given
String mapString = "{k1: 1337, k2: { k1 : 1337, k2: {k1: 1337}}}";
// When
DefaultParameterValue converted = converter.apply(mapString);
// Then
Map<String, Object> map1 = (Map<String, Object>) converted.value();
Map<String, Object> map2 = (Map<String, Object>) map1.get("k2");
Map<String, Object> map3 = (Map<String, Object>) map2.get("k2");
assertThat(map1.get("k1")).isEqualTo(1337L);
assertThat(map2.get("k1")).isEqualTo(1337L);
assertThat(map3.get("k1")).isEqualTo(1337L);
}
use of org.neo4j.internal.kernel.api.procs.DefaultParameterValue in project neo4j by neo4j.
the class MapConverterTest method shouldHandleEscapedDoubleQuotedInValue1.
@Test
void shouldHandleEscapedDoubleQuotedInValue1() {
// Given
String mapString = "{key: \"va\\\"lue\"}";
// When
DefaultParameterValue converted = converter.apply(mapString);
// Then
assertThat(converted).isEqualTo(ntMap(map("key", "va\"lue")));
}
use of org.neo4j.internal.kernel.api.procs.DefaultParameterValue in project neo4j by neo4j.
the class MapConverterTest method shouldHandleMapsWithLists.
@SuppressWarnings("unchecked")
@Test
void shouldHandleMapsWithLists() {
// Given
String mapString = "{k1: [1337, 42]}";
// When
DefaultParameterValue converted = converter.apply(mapString);
// Then
Map<String, Object> map1 = (Map<String, Object>) converted.value();
assertThat(map1.get("k1")).isEqualTo(asList(1337L, 42L));
}
use of org.neo4j.internal.kernel.api.procs.DefaultParameterValue in project neo4j by neo4j.
the class MapConverterTest method shouldHandleKeyWithEscapedSingleQuote.
@Test
void shouldHandleKeyWithEscapedSingleQuote() {
// Given
String mapString = "{`k\'ey`: \"value\"}";
// When
DefaultParameterValue converted = converter.apply(mapString);
// Then
assertThat(converted).isEqualTo(ntMap(map("k\'ey", "value")));
}
use of org.neo4j.internal.kernel.api.procs.DefaultParameterValue in project neo4j by neo4j.
the class MapConverterTest method shouldHandleEmptyMapWithSpaces.
@Test
void shouldHandleEmptyMapWithSpaces() {
// Given
String mapString = " { } ";
// When
DefaultParameterValue converted = converter.apply(mapString);
// Then
assertThat(converted).isEqualTo(ntMap(emptyMap()));
}
Aggregations