SimpleStepFactoryBean<String, String> factory = getStepFactory("foo", "bar");
factory.setTaskExecutor(new SimpleAsyncTaskExecutor());
factory.setThrottleLimit(1);
AbstractStep step = (AbstractStep) factory.getObject();
step.setName("step1");
JobExecution jobExecution = repository.createJobExecution(job.getName(), new JobParameters());
StepExecution stepExecution = jobExecution.createStepExecution(step.getName());
repository.add(stepExecution);
step.execute(stepExecution);
assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
assertEquals(2, written.size());
assertTrue(written.contains("foo"));
}