@Test public void returnStatisticsForEmptyRecords() { ResultSummary resultSummary = mock(ResultSummary.class); SummaryCounters summaryCounters = mock(SummaryCounters.class); BoltResult result = new ListBoltResult(Collections.emptyList(), resultSummary); when(resultSummary.counters()).thenReturn(summaryCounters); when(summaryCounters.labelsAdded()).thenReturn(1); when(summaryCounters.nodesCreated()).thenReturn(10); String actual = verbosePrinter.format(result); assertThat(actual, containsString("Added 10 nodes, Added 1 labels")); }
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);  }