@Test
@DirtiesContext
public void testFailedStepOnError() throws Exception {
JobExecution jobExecution = jobLauncher.run(job, new JobParameters(Collections.singletonMap("item.three",
new JobParameter("error"))));
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
assertEquals(9, stepExecution.getReadCount());
// In principle the write count could be more than 2 and less than 9...
assertEquals(7, stepExecution.getWriteCount());