use of org.neo4j.driver.Result in project neo4j by neo4j.
the class TableOutputFormatterTest method wrapNumberContentWithLongSize.
@Test
public void wrapNumberContentWithLongSize() {
// GIVEN
Result result = mockResult(asList("c1"), 345, 12, 978623, 132456798, 9223372036854775807L);
// WHEN
ToStringLinePrinter printer = new ToStringLinePrinter();
new TableOutputFormatter(true, 2).formatAndCount(new ListBoltResult(result.list(), result.consume()), printer);
String table = printer.result();
// THEN
assertThat(table, is(String.join(NEWLINE, "+---------------------+", "| c1 |", "+---------------------+", "| 345 |", "| 12 |", "| 978623 |", "| 132456798 |", "| 9223372036854775807 |", "+---------------------+", NEWLINE)));
}
use of org.neo4j.driver.Result in project neo4j by neo4j.
the class TableOutputFormatterTest method fiveRowsWithNumbersNotAllSampled.
@Test
public void fiveRowsWithNumbersNotAllSampled() {
// GIVEN
Result result = mockResult(asList("c1", "c2"), "a", 42, "b", 43, "c", 44, "d", 45, "e", 46);
// WHEN
String table = formatResult(result);
// THEN
assertThat(table, containsString("| \"a\" | 42 |"));
assertThat(table, containsString("| \"b\" | 43 |"));
assertThat(table, containsString("| \"c\" | 44 |"));
assertThat(table, containsString("| \"d\" | 45 |"));
assertThat(table, containsString("| \"e\" | 46 |"));
}
use of org.neo4j.driver.Result in project neo4j by neo4j.
the class TableOutputFormatterTest method formatEntities.
@Test
public void formatEntities() {
// GIVEN
Map<String, Value> properties = singletonMap("name", Values.value("Mark"));
Map<String, Value> relProperties = singletonMap("since", Values.value(2016));
InternalNode node = new InternalNode(12, asList("Person"), properties);
InternalRelationship relationship = new InternalRelationship(24, 12, 12, "TEST", relProperties);
Result result = mockResult(asList("a", "b", "c"), node, relationship, new InternalPath(node, relationship, node));
// WHEN
String table = formatResult(result);
// THEN
assertThat(table, containsString("| (:Person {name: \"Mark\"}) | [:TEST {since: 2016}] |"));
assertThat(table, containsString("| (:Person {name: \"Mark\"})-[:TEST {since: 2016}]->(:Person {name: \"Mark\"}) |"));
}
use of org.neo4j.driver.Result in project neo4j by neo4j.
the class TableOutputFormatterTest method twoRowsWithNumbersAllSampled.
@Test
public void twoRowsWithNumbersAllSampled() {
// GIVEN
Result result = mockResult(asList("c1", "c2"), "a", 42, "b", 43);
// WHEN
String table = formatResult(result);
// THEN
assertThat(table, containsString("| \"a\" | 42 |"));
assertThat(table, containsString("| \"b\" | 43 |"));
}
Aggregations