PrettyCliOutput implements CliOutput { @Override public void printBackfill(Backfill backfill, boolean noTruncate) { printBackfill(backfill, effectiveLongFieldLength( Optional.ofNullable(backfill.workflowId().componentId()), COMPONENT_HEADER, true), effectiveLongFieldLength( Optional.ofNullable(backfill.workflowId().id()), WORKFLOW_HEADER, true), effectiveLongFieldLength( backfill.description(), DESCRIPTION_HEADER, noTruncate), noTruncate); }  @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 shouldPrintBackfill() { cliOutput.printBackfill(backfill(LONG_DESCRIPTION) .builder() .triggerParameters(TriggerParameters .builder() .env("FOO", "bar", "BAR", "foo", "FOOBAR", "foobar") .build()) .build(), false); assertEquals(" 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... BAR=foo FOO=bar " + "FOOB...\n", outContent.toString()); }
@Test public void shouldPrintBackfillWithShortDescription() { cliOutput.printBackfill(backfill(SHORT_DESCRIPTION), false); assertEquals(" 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 shouldPrintBackfillWithoutTruncating() { cliOutput.printBackfill(backfill(LONG_DESCRIPTION) .builder() .triggerParameters(TriggerParameters .builder() .env("FOO", "bar", "BAR", "foo", "FOOBAR", "foobar") .build()) .build(), true); assertEquals(" 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 BAR=foo FOO=bar FOOBAR=foobar\n", outContent.toString()); }