Search in sources :

Example 26 with ListBoltResult

use of org.neo4j.shell.state.ListBoltResult 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

ListBoltResult (org.neo4j.shell.state.ListBoltResult)26 Test (org.junit.Test)24 Value (org.neo4j.driver.Value)20 BoltResult (org.neo4j.shell.state.BoltResult)18 Record (org.neo4j.driver.Record)16 ResultSummary (org.neo4j.driver.summary.ResultSummary)14 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)12 StringContains.containsString (org.hamcrest.core.StringContains.containsString)12 DurationValue (org.neo4j.driver.internal.value.DurationValue)8 NodeValue (org.neo4j.driver.internal.value.NodeValue)8 PathValue (org.neo4j.driver.internal.value.PathValue)8 PointValue (org.neo4j.driver.internal.value.PointValue)8 RelationshipValue (org.neo4j.driver.internal.value.RelationshipValue)8 HashMap (java.util.HashMap)7 InternalRecord (org.neo4j.driver.internal.InternalRecord)7 Node (org.neo4j.driver.types.Node)6 Relationship (org.neo4j.driver.types.Relationship)6 Matchers.anyObject (org.mockito.Matchers.anyObject)4 Result (org.neo4j.driver.Result)4 ProfiledPlan (org.neo4j.driver.summary.ProfiledPlan)4