Search in sources :

Example 1 with PathValue

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

the class PrettyPrinterTest method shouldHandlePaths.

@Test
void shouldHandlePaths() {
    // Given
    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);
    PathValue path = VirtualValues.path(new NodeValue[] { startNode, endNode }, new RelationshipValue[] { rel });
    PrettyPrinter printer = new PrettyPrinter();
    // When
    path.writeTo(printer);
    // Then
    assertThat(printer.value()).isEqualTo("(id=1 :L)-[id=42 :R]->(id=2 :L)");
}
Also used : NodeValue(org.neo4j.values.virtual.NodeValue) PathValue(org.neo4j.values.virtual.PathValue) RelationshipValue(org.neo4j.values.virtual.RelationshipValue) Test(org.junit.jupiter.api.Test)

Example 2 with PathValue

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

the class Neo4jPackV1Test method shouldNotBeAbleToUnpackPaths.

@Test
void shouldNotBeAbleToUnpackPaths() {
    for (PathValue path : ALL_PATHS) {
        var ex = assertThrows(BoltIOException.class, () -> unpacked(packed(path)));
        assertEquals(Neo4jError.from(TypeError, "Path values cannot be unpacked with this version of bolt."), Neo4jError.from(ex));
    }
}
Also used : PathValue(org.neo4j.values.virtual.PathValue) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 PathValue (org.neo4j.values.virtual.PathValue)2 NodeValue (org.neo4j.values.virtual.NodeValue)1 RelationshipValue (org.neo4j.values.virtual.RelationshipValue)1