@Test
public void testWorkflowCreateInvalid() throws Exception {

  final String component = "quux";
  final Path workflowsFile = fileFromResource("workflows.yaml");
  final List<WorkflowConfiguration> expected = Json.YAML_MAPPER
      .reader().forType(WorkflowConfiguration.class)
      .<WorkflowConfiguration>readValues(workflowsFile.toFile())
      .readAll();
  assertThat(expected, is(not(Matchers.empty())));
  for (WorkflowConfiguration configuration : expected) {
    var workflow = Workflow.create(component, configuration);
    when(validator.validateWorkflow(workflow)).thenReturn(
        List.of("bad-" + configuration.id(), "cfg-" + configuration.id()));
  }
  try {
    CliMain.run(cliContext, "workflow", "create", component, "-f", workflowsFile.toString());
    fail();
  } catch (CliExitException e) {
    assertThat(e.status(), is(ExitStatus.ArgumentError));
  }
  for (WorkflowConfiguration configuration : expected) {
    verify(cliOutput).printError("Invalid workflow configuration: " + configuration.id());
    verify(cliOutput).printError("  error: bad-" + configuration.id());
    verify(cliOutput).printError("  error: cfg-" + configuration.id());
  }
  verify(client, never()).createOrUpdateWorkflow(any(), any());
}