use of org.neo4j.values.virtual.ListValue in project neo4j by neo4j.
the class PrettyPrinterTest method shouldHandleLists.
@Test
void shouldHandleLists() {
// Given
PrettyPrinter printer = new PrettyPrinter();
ListValue list = list(stringValue("foo"), byteValue((byte) 42));
// When
list.writeTo(printer);
// Then
assertThat(printer.value()).isEqualTo("[\"foo\", 42]");
}
use of org.neo4j.values.virtual.ListValue in project neo4j by neo4j.
the class PrettyPrinterTest method shouldHandleListsWithListsAndMaps.
@Test
void shouldHandleListsWithListsAndMaps() {
// Given
PrettyPrinter printer = new PrettyPrinter();
ListValue list = list(intValue(1), list(intValue(2), props("k", intValue(3))));
// When
list.writeTo(printer);
// Then
assertThat(printer.value()).isEqualTo("[1, [2, {k: 3}]]");
}
use of org.neo4j.values.virtual.ListValue in project neo4j by neo4j.
the class ValueUtilsTest method shouldHandleIterator.
@Test
void shouldHandleIterator() {
// Given
Iterator<Integer> iterator = Arrays.asList(1, 2, 3).iterator();
// When
AnyValue of = ValueUtils.of(iterator);
// Then
assertThat(of).isInstanceOf(ListValue.class);
ListValue listValue = (ListValue) of;
assertThat(listValue.value(0)).isEqualTo(intValue(1));
assertThat(listValue.value(1)).isEqualTo(intValue(2));
assertThat(listValue.value(2)).isEqualTo(intValue(3));
assertThat(listValue.size()).isEqualTo(3);
}
use of org.neo4j.values.virtual.ListValue in project neo4j by neo4j.
the class ValueUtilsTest method shouldHandleIterable.
@Test
void shouldHandleIterable() {
// Given
Iterable<Integer> collection = Arrays.asList(1, 2, 3);
// When
AnyValue of = ValueUtils.of(collection);
// Then
assertThat(of).isInstanceOf(ListValue.class);
ListValue listValue = (ListValue) of;
assertThat(listValue.value(0)).isEqualTo(intValue(1));
assertThat(listValue.value(1)).isEqualTo(intValue(2));
assertThat(listValue.value(2)).isEqualTo(intValue(3));
assertThat(listValue.size()).isEqualTo(3);
}
use of org.neo4j.values.virtual.ListValue in project neo4j by neo4j.
the class PrettyPrinterTest method shouldHandleListsWithListsAndMaps1.
@Test
void shouldHandleListsWithListsAndMaps1() {
// Given
PrettyPrinter printer = new PrettyPrinter();
ListValue list = list(intValue(1), props("k", intValue(3)));
// When
list.writeTo(printer);
// Then
assertThat(printer.value()).isEqualTo("[1, {k: 3}]");
}
Aggregations