private long startJobMatchFail() throws Exception {
//start the job and fail at the end of step2, matching <fail> element in step2
final Properties params = createParams(Batchlet1.ACTION, Batchlet1.ACTION_FAIL);
System.out.printf("Start with params %s%n", params);
final long jobExecutionId = jobOperator.start(jobName, params);
final JobExecutionImpl jobExecution = (JobExecutionImpl) jobOperator.getJobExecution(jobExecutionId);
jobExecution.awaitTermination(waitTimeoutMinutes, TimeUnit.MINUTES);
System.out.printf("JobExecution id: %s%n", jobExecution.getExecutionId());
Assert.assertEquals(BatchStatus.FAILED, jobExecution.getBatchStatus());
Assert.assertEquals(Batchlet1.ACTION_FAIL, jobExecution.getExitStatus()); //set by <fail> element
Assert.assertEquals(2, jobExecution.getStepExecutions().size());
Assert.assertEquals(BatchStatus.COMPLETED, jobExecution.getStepExecutions().get(0).getBatchStatus());
Assert.assertEquals(BatchStatus.COMPLETED.name(), jobExecution.getStepExecutions().get(0).getExitStatus());
// <fail> element does not affect the already-completed step batchlet execution.
// Although the job FAILED, but step2 still COMPLETED
Assert.assertEquals(BatchStatus.COMPLETED, jobExecution.getStepExecutions().get(1).getBatchStatus());
// step2 exit status from batchlet1.process method return value, not from <fail exit-status> element
Assert.assertEquals(Batchlet1.ACTION_FAIL, jobExecution.getStepExecutions().get(1).getExitStatus());
return jobExecutionId;
}