}
}
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
factory.afterPropertiesSet();
JobRepository repository = factory.getObject();
job.setJobRepository(repository);
job.setRestartable(true);
JobExecution execution = repository.createJobExecution("testHandleStepJob", new JobParameters());
job.handleStep(new StubStep(), execution);
assertEquals(StubStep.value, execution.getExecutionContext().get(StubStep.key));
// simulate restart and check the job execution context's content survives
execution.setEndTime(new Date());
execution.setStatus(BatchStatus.FAILED);
repository.update(execution);
JobExecution restarted = repository.createJobExecution("testHandleStepJob", new JobParameters());
assertEquals(StubStep.value, restarted.getExecutionContext().get(StubStep.key));
}