Search in sources :

Example 11 with NodeValue

use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.

the class PrettyPrinterTest method shouldHandleNodeValueAsReference.

@Test
void shouldHandleNodeValueAsReference() {
    // Given
    NodeValue node = VirtualValues.nodeValue(42L, Values.stringArray("L1", "L2", "L3"), props("foo", intValue(42), "bar", list(intValue(1337), stringValue("baz"))));
    PrettyPrinter printer = new PrettyPrinter(REFERENCE);
    // When
    node.writeTo(printer);
    // Then
    assertThat(printer.value()).isEqualTo("(id=42)");
}
Also used : NodeValue(org.neo4j.values.virtual.NodeValue) Test(org.junit.jupiter.api.Test)

Example 12 with NodeValue

use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.

the class PrettyPrinterTest method shouldHandleRelationshipValueWithoutProperties.

@Test
void shouldHandleRelationshipValueWithoutProperties() {
    NodeValue startNode = VirtualValues.nodeValue(1L, Values.stringArray("L"), EMPTY_MAP);
    NodeValue endNode = VirtualValues.nodeValue(2L, Values.stringArray("L"), EMPTY_MAP);
    RelationshipValue rel = VirtualValues.relationshipValue(42L, startNode, endNode, stringValue("R"), EMPTY_MAP);
    PrettyPrinter printer = new PrettyPrinter();
    // When
    rel.writeTo(printer);
    // Then
    assertThat(printer.value()).isEqualTo("-[id=42 :R]-");
}
Also used : NodeValue(org.neo4j.values.virtual.NodeValue) RelationshipValue(org.neo4j.values.virtual.RelationshipValue) Test(org.junit.jupiter.api.Test)

Example 13 with NodeValue

use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.

the class PrettyPrinterTest method shouldHandleNodeValueWithoutLabels.

@Test
void shouldHandleNodeValueWithoutLabels() {
    // Given
    NodeValue node = VirtualValues.nodeValue(42L, Values.stringArray(), props("foo", intValue(42), "bar", list(intValue(1337), stringValue("baz"))));
    PrettyPrinter printer = new PrettyPrinter();
    // When
    node.writeTo(printer);
    // Then
    assertThat(printer.value()).isEqualTo("(id=42 {bar: [1337, \"baz\"], foo: 42})");
}
Also used : NodeValue(org.neo4j.values.virtual.NodeValue) Test(org.junit.jupiter.api.Test)

Example 14 with NodeValue

use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.

the class PrettyPrinterTest method shouldHandleNodeValue.

@Test
void shouldHandleNodeValue() {
    // Given
    NodeValue node = VirtualValues.nodeValue(42L, Values.stringArray("L1", "L2", "L3"), props("foo", intValue(42), "bar", list(intValue(1337), stringValue("baz"))));
    PrettyPrinter printer = new PrettyPrinter();
    // When
    node.writeTo(printer);
    // Then
    assertThat(printer.value()).isEqualTo("(id=42 :L1:L2:L3 {bar: [1337, \"baz\"], foo: 42})");
}
Also used : NodeValue(org.neo4j.values.virtual.NodeValue) Test(org.junit.jupiter.api.Test)

Example 15 with NodeValue

use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.

the class PrettyPrinterTest method shouldHandleNodeValueWithoutProperties.

@Test
void shouldHandleNodeValueWithoutProperties() {
    // Given
    NodeValue node = VirtualValues.nodeValue(42L, Values.stringArray("L1", "L2", "L3"), EMPTY_MAP);
    PrettyPrinter printer = new PrettyPrinter();
    // When
    node.writeTo(printer);
    // Then
    assertThat(printer.value()).isEqualTo("(id=42 :L1:L2:L3)");
}
Also used : NodeValue(org.neo4j.values.virtual.NodeValue) Test(org.junit.jupiter.api.Test)

Aggregations

NodeValue (org.neo4j.values.virtual.NodeValue)26 Test (org.junit.jupiter.api.Test)22 RelationshipValue (org.neo4j.values.virtual.RelationshipValue)13 AnyValue (org.neo4j.values.AnyValue)5 PathValue (org.neo4j.values.virtual.PathValue)3 Values.stringValue (org.neo4j.values.storable.Values.stringValue)2 ListValue (org.neo4j.values.virtual.ListValue)2 MapValue (org.neo4j.values.virtual.MapValue)2 VirtualNodeValue (org.neo4j.values.virtual.VirtualNodeValue)2 VirtualRelationshipValue (org.neo4j.values.virtual.VirtualRelationshipValue)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)1 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)1 ArgumentMatchers.anyLong (org.mockito.ArgumentMatchers.anyLong)1 Mockito (org.mockito.Mockito)1 Mockito.mock (org.mockito.Mockito.mock)1 Mockito.when (org.mockito.Mockito.when)1 Answer (org.mockito.stubbing.Answer)1