### Question:
BasicCommandTaskExecutor implements TaskExecutor { @Override public void execute(TaskExecutionContext context, TaskInfo task) throws InterruptedException, IOException { CommandTaskInfo mirror = (CommandTaskInfo) task; CommandLauncher launcher = launchers.apply(context); Path command = TaskExecutors.findFrameworkFile(context, mirror.getCommand()).get(); List<String> arguments = TaskExecutors.resolveCommandTokens( context, mirror.getArguments(context.getConfigurations())); execute(context, launcher, command, arguments); } BasicCommandTaskExecutor();  BasicCommandTaskExecutor(Function<? super TaskExecutionContext, ? extends CommandLauncher> launchers); @Override boolean isSupported(TaskExecutionContext context, TaskInfo task); @Override void execute(TaskExecutionContext context, TaskInfo task); static CommandLauncher getCommandLauncher(ExecutionContext context); static CommandLauncher getCommandLauncher(
            ExecutionContext context,
            BasicCommandLauncher.OutputConsumer output); static void execute(
            TaskExecutionContext context,
            Path command, List<String> arguments); static void execute(
            TaskExecutionContext context, CommandLauncher launcher,
            Path command, List<String> arguments); static final boolean WINDOWS; }### Answer:
@Test public void simple() throws Exception { String cmd = command("mock.cmd"); TaskExecutor executor = new BasicCommandTaskExecutor(c -> (command, arguments) -> { assertThat(command.getFileName().toString(), is(cmd)); assertThat(arguments, contains( "Hello, world!", context.getBatchId(), context.getFlowId(), context.getExecutionId(), "testing=OK")); return 0; }); executor.execute(context, new BasicCommandTaskInfo("mock", "testing", cmd, Arrays.asList( CommandToken.of("Hello, world!"), CommandToken.BATCH_ID, CommandToken.FLOW_ID, CommandToken.EXECUTION_ID, CommandToken.BATCH_ARGUMENTS))); }
@Test public void path_ext() throws Exception { String cmd = command("mock"); String cmdExt = command("mock.cmd"); String expect; if (BasicCommandTaskExecutor.WINDOWS) { parent.withEnvironmentVariables(m -> m.put("PathExt", ".EXE;.BAT;.CMD")); expect = cmdExt; } else { expect = cmd; } TaskExecutor executor = new BasicCommandTaskExecutor(c -> (command, arguments) -> { assertThat(command.getFileName().toString().toLowerCase(Locale.ENGLISH), is(expect)); assertThat(arguments, contains( "Hello, world!", context.getBatchId(), context.getFlowId(), context.getExecutionId(), "testing=OK")); return 0; }); executor.execute(context, new BasicCommandTaskInfo("mock", "testing", cmd, Arrays.asList( CommandToken.of("Hello, world!"), CommandToken.BATCH_ID, CommandToken.FLOW_ID, CommandToken.EXECUTION_ID, CommandToken.BATCH_ARGUMENTS))); }
@Test(expected = Exception.class) public void abend() throws Exception { String cmd = command("mock.cmd"); TaskExecutor executor = new BasicCommandTaskExecutor(c -> (command, arguments) -> { return 1; }); executor.execute(context, new BasicCommandTaskInfo("mock", "testing", cmd, Arrays.asList())); }