PrettyCliOutput implements CliOutput { @Override public void printBackfillPayload(BackfillPayload backfillPayload, boolean noTruncate) { printBackfillHeader( effectiveLongFieldLength( Optional.ofNullable(backfillPayload.backfill().workflowId().componentId()), COMPONENT_HEADER, true), effectiveLongFieldLength(Optional.ofNullable(backfillPayload.backfill().workflowId().id()), WORKFLOW_HEADER, true), effectiveLongFieldLength(backfillPayload.backfill().description(), DESCRIPTION_HEADER, noTruncate)); printBackfill(backfillPayload.backfill(), noTruncate); if (backfillPayload.statuses().isPresent()) { System.out.println(); System.out.println(); printStates(backfillPayload.statuses().get()); } }  @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 shouldPrintBackfillPayload() { cliOutput.printBackfillPayload(BackfillPayload.create(backfill(LONG_DESCRIPTION), Optional.empty()), false); assertEquals(EXPECTED_HEADER_WITH_TRUNCATED_DESCRIPTION + " backfill-2 false false " + " 2 " + "2017-01-01 2017-01-02 false 2017-01-01 component " + "workflow2 2019-01-01T00:00:00Z 2019-06-01T00:00:00Z Description which is... FOO=bar\n", outContent.toString()); }
@Test public void shouldPrintBackfillPayloadWithShortDescription() { cliOutput.printBackfillPayload(BackfillPayload.create(backfill(SHORT_DESCRIPTION), Optional.empty()), false); assertEquals(EXPECTED_HEADER + " backfill-2 false false " + " 2 " + "2017-01-01 2017-01-02 false 2017-01-01 component " + "workflow2 2019-01-01T00:00:00Z 2019-06-01T00:00:00Z Description FOO=bar\n", outContent.toString()); }
@Test public void shouldPrintBackfillPayloadWithoutTruncating() { cliOutput.printBackfillPayload(BackfillPayload.create(backfill(LONG_DESCRIPTION), Optional.empty()), true); assertEquals(EXPECTED_HEADER_WITH_FULL_DESCRIPTION + " backfill-2 false false 2 " + "2017-01-01 2017-01-02 false 2017-01-01 component " + "workflow2 2019-01-01T00:00:00Z 2019-06-01T00:00:00Z Description which is long enough to truncate FOO=bar\n", outContent.toString()); }