DefaultStepService implements StepService { @Override public void attachStepExecutions(JobExecution jobExecution) { jobExecution = this.jobExplorer.getJobExecution(jobExecution.getId()); if (jobExecution == null) { throw new SpringBatchLightminApplicationException("Could not attach StepExecutions for JobExecution"); } } DefaultStepService(final JobExplorer jobExplorer); @Override StepExecution getStepExecution(final JobExecution jobExecution, final Long stepExecutionId); @Override void attachStepExecutions(JobExecution jobExecution); @Override void afterPropertiesSet();  }
@Test public void testAttachStepExecutions() { final JobExecution jobExecution = DomainTestHelper.createJobExecution(20L); when(this.jobExplorer.getJobExecution(jobExecution.getId())).thenReturn(jobExecution); this.stepService.attachStepExecutions(jobExecution); verify(this.jobExplorer, times(1)).getJobExecution(jobExecution.getId()); }