RunLoadFlowTool implements Tool { private void printLoadFlowResult(LoadFlowResult result, Path outputFile, TableFormatterFactory formatterFactory, TableFormatterConfig formatterConfig) { try (Writer writer = Files.newBufferedWriter(outputFile, StandardCharsets.UTF_8)) { printLoadFlowResult(result, writer, formatterFactory, formatterConfig); } catch (IOException e) { throw new UncheckedIOException(e); } }  @Override Command getCommand(); @Override void run(CommandLine line, ToolRunningContext context);  }
@Test public void printLoadFlowResultTest() throws IOException { LoadFlowResult result = new LoadFlowResultImpl(true, Collections.emptyMap(), "", Collections.singletonList(new LoadFlowResultImpl.ComponentResultImpl(0, LoadFlowResult.ComponentResult.Status.CONVERGED, 8, "mySlack", 0.01))); try (StringWriter writer = new StringWriter()) { RunLoadFlowTool.printLoadFlowResult(result, writer, new AsciiTableFormatterFactory(), new TableFormatterConfig(Locale.US, "inv")); writer.flush(); compareTxt(getClass().getResourceAsStream("/LoadFlowResultResult.txt"), writer.toString()); } }