@Test public void prettyPrintRelationships() { Record record = mock(Record.class); Value value = mock(Value.class); Relationship relationship = mock(Relationship.class); HashMap<String, Object> propertiesAsMap = new HashMap<>(); propertiesAsMap.put("prop1", "prop1_value"); propertiesAsMap.put("prop2", "prop2_value"); when(value.type()).thenReturn(InternalTypeSystem.TYPE_SYSTEM.RELATIONSHIP()); when(value.asRelationship()).thenReturn(relationship); when(relationship.type()).thenReturn("RELATIONSHIP_TYPE"); when(relationship.asMap(anyObject())).thenReturn(unmodifiableMap(propertiesAsMap)); when(record.keys()).thenReturn(asList("rel")); when(record.values()).thenReturn(asList(value)); BoltResult result = new ListBoltResult(asList(record), mock(ResultSummary.class)); String actual = plainPrinter.format(result); assertThat(actual, is("rel" + NEWLINE+ "[:RELATIONSHIP_TYPE {prop2: prop2_value, prop1: prop1_value}]" + NEWLINE)); }
public void format(@Nonnull final BoltResult result, LinePrinter linePrinter) { Set<OutputFormatter.Capabilities> capabilities = outputFormatter.capabilities(); int numberOfRows = 0; if (capabilities.contains(RESULT)) { numberOfRows = outputFormatter.formatAndCount(result, linePrinter); } if (capabilities.contains(INFO)) printIfNotEmpty(outputFormatter.formatInfo(result.getSummary()), linePrinter); if (capabilities.contains(PLAN)) printIfNotEmpty(outputFormatter.formatPlan(result.getSummary()), linePrinter); if (capabilities.contains(FOOTER)) printIfNotEmpty(outputFormatter.formatFooter(result, numberOfRows), linePrinter); if (capabilities.contains(STATISTICS)) printIfNotEmpty(statisticsCollector.collect(result.getSummary()), linePrinter); }
PrettyPrinter { public void format(@Nonnull final BoltResult result, LinePrinter linePrinter) { Set<OutputFormatter.Capabilities> capabilities = outputFormatter.capabilities(); int numberOfRows = 0; if (capabilities.contains(RESULT)) { numberOfRows = outputFormatter.formatAndCount(result, linePrinter); } if (capabilities.contains(INFO)) printIfNotEmpty(outputFormatter.formatInfo(result.getSummary()), linePrinter); if (capabilities.contains(PLAN)) printIfNotEmpty(outputFormatter.formatPlan(result.getSummary()), linePrinter); if (capabilities.contains(FOOTER)) printIfNotEmpty(outputFormatter.formatFooter(result, numberOfRows), linePrinter); if (capabilities.contains(STATISTICS)) printIfNotEmpty(statisticsCollector.collect(result.getSummary()), linePrinter); } }
PrettyPrinter { public void format(@Nonnull final BoltResult result, LinePrinter linePrinter) { Set<OutputFormatter.Capabilities> capabilities = outputFormatter.capabilities(); int numberOfRows = 0; if (capabilities.contains(RESULT)) { numberOfRows = outputFormatter.formatAndCount(result, linePrinter); } if (capabilities.contains(INFO)) printIfNotEmpty(outputFormatter.formatInfo(result.getSummary()), linePrinter); if (capabilities.contains(PLAN)) printIfNotEmpty(outputFormatter.formatPlan(result.getSummary()), linePrinter); if (capabilities.contains(FOOTER)) printIfNotEmpty(outputFormatter.formatFooter(result, numberOfRows), linePrinter); if (capabilities.contains(STATISTICS)) printIfNotEmpty(statisticsCollector.collect(result.getSummary()), linePrinter); } PrettyPrinter(@Nonnull PrettyConfig prettyConfig); }
PrettyPrinter { public void format(@Nonnull final BoltResult result, LinePrinter linePrinter) { Set<OutputFormatter.Capabilities> capabilities = outputFormatter.capabilities(); int numberOfRows = 0; if (capabilities.contains(RESULT)) { numberOfRows = outputFormatter.formatAndCount(result, linePrinter); } if (capabilities.contains(INFO)) printIfNotEmpty(outputFormatter.formatInfo(result.getSummary()), linePrinter); if (capabilities.contains(PLAN)) printIfNotEmpty(outputFormatter.formatPlan(result.getSummary()), linePrinter); if (capabilities.contains(FOOTER)) printIfNotEmpty(outputFormatter.formatFooter(result, numberOfRows), linePrinter); if (capabilities.contains(STATISTICS)) printIfNotEmpty(statisticsCollector.collect(result.getSummary()), linePrinter); } PrettyPrinter(@Nonnull PrettyConfig prettyConfig); void format(@Nonnull final BoltResult result, LinePrinter linePrinter); }
PrettyPrinter { public void format(@Nonnull final BoltResult result, LinePrinter linePrinter) { Set<OutputFormatter.Capabilities> capabilities = outputFormatter.capabilities(); int numberOfRows = 0; if (capabilities.contains(RESULT)) { numberOfRows = outputFormatter.formatAndCount(result, linePrinter); } if (capabilities.contains(INFO)) printIfNotEmpty(outputFormatter.formatInfo(result.getSummary()), linePrinter); if (capabilities.contains(PLAN)) printIfNotEmpty(outputFormatter.formatPlan(result.getSummary()), linePrinter); if (capabilities.contains(FOOTER)) printIfNotEmpty(outputFormatter.formatFooter(result, numberOfRows), linePrinter); if (capabilities.contains(STATISTICS)) printIfNotEmpty(statisticsCollector.collect(result.getSummary()), linePrinter); } PrettyPrinter(@Nonnull PrettyConfig prettyConfig); void format(@Nonnull final BoltResult result, LinePrinter linePrinter);  }