@Test
public void attachJobInstanceTest() {

    final JobExecution jobExecution = DomainTestHelper.createJobExecution(10L);
    final JobInstance jobInstance = DomainTestHelper.createJobInstance(20L, JOB_NAME);
    jobExecution.setJobInstance(jobInstance);
    when(this.jobExplorer.getJobInstance(jobExecution.getJobInstance().getId())).thenReturn(jobInstance);
    this.jobService.attachJobInstance(jobExecution);
    assertThat(jobExecution.getJobInstance()).isEqualTo(jobInstance);
}