Search in sources :

Example 6 with InternalRecord

use of org.neo4j.driver.internal.InternalRecord in project neo4j by neo4j.

the class TableOutputFormatterTest method prettyPrintDuration.

@Test
public void prettyPrintDuration() {
    // given
    List<String> keys = asList("d");
    Value duration = new DurationValue(new InternalIsoDuration(1, 2, 3, 4));
    Record record = new InternalRecord(keys, new Value[] { duration });
    // when
    String actual = verbosePrinter.format(new ListBoltResult(asList(record), mock(ResultSummary.class)));
    // then
    assertThat(actual, containsString("| P1M2DT3.000000004S |"));
}
Also used : InternalRecord(org.neo4j.driver.internal.InternalRecord) ListBoltResult(org.neo4j.shell.state.ListBoltResult) DurationValue(org.neo4j.driver.internal.value.DurationValue) Value(org.neo4j.driver.Value) RelationshipValue(org.neo4j.driver.internal.value.RelationshipValue) NodeValue(org.neo4j.driver.internal.value.NodeValue) DurationValue(org.neo4j.driver.internal.value.DurationValue) PathValue(org.neo4j.driver.internal.value.PathValue) PointValue(org.neo4j.driver.internal.value.PointValue) InternalRecord(org.neo4j.driver.internal.InternalRecord) Record(org.neo4j.driver.Record) StringContains.containsString(org.hamcrest.core.StringContains.containsString) InternalIsoDuration(org.neo4j.driver.internal.InternalIsoDuration) Test(org.junit.Test)

Example 7 with InternalRecord

use of org.neo4j.driver.internal.InternalRecord in project neo4j by neo4j.

the class TableOutputFormatterTest method prettyPrintNode.

@Test
public void prettyPrintNode() {
    // given
    List<String> labels = asList("label1", "label2");
    Map<String, Value> propertiesAsMap = new HashMap<>();
    propertiesAsMap.put("prop1", Values.value("prop1_value"));
    propertiesAsMap.put("prop2", Values.value("prop2_value"));
    List<String> keys = asList("col1", "col2");
    Value value = new NodeValue(new InternalNode(1, labels, propertiesAsMap));
    Record record = new InternalRecord(keys, new Value[] { value });
    // when
    String actual = verbosePrinter.format(new ListBoltResult(asList(record), mock(ResultSummary.class)));
    // then
    assertThat(actual, containsString("| (:label1:label2 {prop2: \"prop2_value\", prop1: \"prop1_value\"}) |"));
}
Also used : NodeValue(org.neo4j.driver.internal.value.NodeValue) InternalRecord(org.neo4j.driver.internal.InternalRecord) ListBoltResult(org.neo4j.shell.state.ListBoltResult) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Value(org.neo4j.driver.Value) RelationshipValue(org.neo4j.driver.internal.value.RelationshipValue) NodeValue(org.neo4j.driver.internal.value.NodeValue) DurationValue(org.neo4j.driver.internal.value.DurationValue) PathValue(org.neo4j.driver.internal.value.PathValue) PointValue(org.neo4j.driver.internal.value.PointValue) InternalRecord(org.neo4j.driver.internal.InternalRecord) Record(org.neo4j.driver.Record) StringContains.containsString(org.hamcrest.core.StringContains.containsString) InternalNode(org.neo4j.driver.internal.InternalNode) Test(org.junit.Test)

Aggregations

Record (org.neo4j.driver.Record)7 Value (org.neo4j.driver.Value)7 InternalRecord (org.neo4j.driver.internal.InternalRecord)7 StringContains.containsString (org.hamcrest.core.StringContains.containsString)6 Test (org.junit.Test)6 DurationValue (org.neo4j.driver.internal.value.DurationValue)6 NodeValue (org.neo4j.driver.internal.value.NodeValue)6 PathValue (org.neo4j.driver.internal.value.PathValue)6 PointValue (org.neo4j.driver.internal.value.PointValue)6 RelationshipValue (org.neo4j.driver.internal.value.RelationshipValue)6 ListBoltResult (org.neo4j.shell.state.ListBoltResult)6 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 InternalIsoDuration (org.neo4j.driver.internal.InternalIsoDuration)2 InternalNode (org.neo4j.driver.internal.InternalNode)2 InternalRelationship (org.neo4j.driver.internal.InternalRelationship)2 Nonnull (javax.annotation.Nonnull)1 InternalPath (org.neo4j.driver.internal.InternalPath)1 InternalPoint2D (org.neo4j.driver.internal.InternalPoint2D)1 InternalPoint3D (org.neo4j.driver.internal.InternalPoint3D)1