CliMain { private void workflowDelete() throws ExecutionException, InterruptedException { final String component = namespace.getString(parser.workflowDeleteComponentId.getDest()); final List<String> workflows = namespace.getList(parser.workflowDeleteWorkflowId.getDest()); final boolean force = namespace.getBoolean(parser.workflowDeleteForce.getDest()); if (cliContext.hasConsole() && !force) { final String reply = cliContext.consoleReadLine( "Sure you want to delete the workflow" + (workflows.size() > 1 ? "s" : "") + " " + String.join(", ", workflows) + " in component " + component + "? [y/N] ").trim(); if (!"y".equals(reply)) { throw CliExitException.of(ExitStatus.UnknownError); } } final List<Tuple2<String, CompletionStage<Void>>> futures = workflows.stream() .map(workflow -> Tuple.of(workflow, styxClient.deleteWorkflow(component, workflow))) .collect(toList()); for (Tuple2<String, CompletionStage<Void>> future : futures) { final String workflow = future._1; try { future._2.toCompletableFuture().get(); cliOutput.printMessage("Workflow " + workflow + " in component " + component + " deleted."); } catch (ExecutionException e) { handleWorkflowNotFound(component, workflow, e); } } } private  CliMain(
      StyxCliParser parser,
      Namespace namespace,
      String apiHost,
      CliOutput cliOutput,
      CliContext cliContext,
      boolean debug); static void main(String... args);  }
@Test public void testWorkflowDelete() { final String component = "quux"; when(client.deleteWorkflow(any(), any())).thenReturn(CompletableFuture.completedFuture(null)); CliMain.run(cliContext, "workflow", "delete", component, "foo", "bar"); verify(client).deleteWorkflow(component, "foo"); verify(client).deleteWorkflow(component, "bar"); verify(cliOutput).printMessage("Workflow foo in component " + component + " deleted."); verify(cliOutput).printMessage("Workflow bar in component " + component + " deleted."); }