PrettyCliOutput implements CliOutput { @Override public void printWorkflows(List<Workflow> workflows) { final int cidLength = workflows.stream() .map(x -> x.componentId().length()) .max(Comparator.naturalOrder()) .orElse(1); final int widLength = workflows.stream() .map(x -> x.workflowId().length()) .max(Comparator.naturalOrder()) .orElse(1); printWorkflowHeader(cidLength, widLength); workflows.forEach(wf -> printWorkflow(wf, cidLength, widLength)); }  @Override void printStates(RunStateDataPayload runStateDataPayload); @Override void printEvents(List<EventInfo> eventInfos); @Override void printBackfill(Backfill backfill, boolean noTruncate); @Override void printBackfillPayload(BackfillPayload backfillPayload, boolean noTruncate); @Override void printBackfills(List<BackfillPayload> backfills, boolean noTruncate); @Override void printResources(List<Resource> resources); @Override void printMessage(String message); @Override void printWorkflow(Workflow wf, WorkflowState state); @Override void printWorkflows(List<Workflow> workflows); @Override void printError(String message);  }
@Test public void shouldPrintWorkflows() { final Workflow foo1 = Workflow.create("foo1", WorkflowConfiguration.builder() .id("bar1") .schedule(Schedule.DAYS) .build()); final Workflow foo2 = Workflow.create("foo2", WorkflowConfiguration.builder() .id("bar2") .schedule(Schedule.DAYS) .build()); cliOutput.printWorkflows(List.of(foo1, foo2)); assertThat(outContent.toString(), is(String.format( "COMPONENT WORKFLOW%n" + "foo1 bar1%n" + "foo2 bar2%n"))); }