@Test
public void test1() throws Exception {

    LocalCommandExecutor localCommandExecutor = new AbstractLocalCommandExecutor() {
        @Override
        void nonZeroLog(List<String> cmdLs, int exitCode) {
        }
        @Override
        public int execute(String program, List<String> args, Path outFile, Path errFile, Path workingDir, Map<String, String> env) throws IOException, InterruptedException {
            // check command line is correct
            assertEquals("prog1", program);
            assertEquals(ImmutableList.of("file1", "file2", "file3"), args);
            assertEquals(ImmutableMap.of("var1", "val1"), env);
            // check working directory exists, contains inout files and standard output file
            assertTrue(Files.exists(workingDir));
            assertEquals(workingDir.resolve("prog1_cmd_0.out").toString(), outFile.toString());
            assertEquals(workingDir.resolve("prog1_cmd_0.err").toString(), errFile.toString());
            assertTrue(Files.exists(workingDir.resolve("file1")));
            assertTrue(Files.exists(workingDir.resolve("file2")));
            assertTrue(Files.exists(workingDir.resolve("file3")));
            // command exits badly
            return 1;
        }
    };
    try (ComputationManager computationManager = new LocalComputationManager(config, localCommandExecutor, ForkJoinPool.commonPool())) {
        computationManager.execute(new ExecutionEnvironment(ImmutableMap.of("var1", "val1"), PREFIX, false),
                new AbstractExecutionHandler<Object>() {
                    @Override
                    public List<CommandExecution> before(Path workingDir) throws IOException {
                        // create files in the working directory
                        Files.createFile(workingDir.resolve("file1"));
                        try (OutputStream os = new GZIPOutputStream(Files.newOutputStream(workingDir.resolve("file2.gz")))) {
                        }
                        try (ZipOutputStream os = new ZipOutputStream(Files.newOutputStream(workingDir.resolve("file3.zip")))) {
                            os.putNextEntry(new ZipEntry("file3"));
                            os.closeEntry();
                        }
                        // run the command
                        Command command = new SimpleCommandBuilder()
                                .id("prog1_cmd")
                                .program("prog1")
                                .args("file1", "file2", "file3")
                                .timeout(60)
                                .inputFiles(new InputFile("file1"),
                                            new InputFile("file2.gz", FilePreProcessor.FILE_GUNZIP),
                                            new InputFile("file3.zip", FilePreProcessor.ARCHIVE_UNZIP))
                                .build();
                        return Collections.singletonList(new CommandExecution(command, 1));
                    }
                    @Override
                    public Object after(Path workingDir, ExecutionReport report) throws IOException {
                        // check command exits with an error
                        assertEquals(1, report.getErrors().size());
                        assertEquals("prog1_cmd", report.getErrors().get(0).getCommand().getId());
                        assertEquals(0, report.getErrors().get(0).getIndex());
                        assertEquals(1, report.getErrors().get(0).getExitCode());
                        return null;
                    }
                }).join();
    }
}