@Test public void prettyPrintList() { Record record1 = mock(Record.class); Record record2 = mock(Record.class); Value value1 = Values.value("val1_1", "val1_2"); Value value2 = Values.value(new String[]{"val2_1"}); when(record1.keys()).thenReturn(asList("col1", "col2")); when(record1.values()).thenReturn(asList(value1, value2)); when(record2.values()).thenReturn(asList(value2)); BoltResult result = new ListBoltResult(asList(record1, record2), mock(ResultSummary.class)); String actual = plainPrinter.format(result); assertThat(actual, is(String.join(NEWLINE, "col1, col2", "[\"val1_1\", \"val1_2\"], [\"val2_1\"]", "[\"val2_1\"]", ""))); }
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);  }