I am having two jobs configured in one context file
<
Maybe late,
but I found for myself working solution: manual configuration of JobLauncherTestUtils:
@Inject
@Qualifier(value = "Job1")
private Job job;
@Inject
private JobLauncher jobLauncher;
@Inject
private JobRepository jobRepository;
private JobLauncherTestUtils jobLauncherTestUtils;
private void initailizeJobLauncherTestUtils() {
this.jobLauncherTestUtils = new JobLauncherTestUtils();
this.jobLauncherTestUtils.setJobLauncher(jobLauncher);
this.jobLauncherTestUtils.setJobRepository(jobRepository);
this.jobLauncherTestUtils.setJob(job);
}
@Before
public void setUp() throws Exception {
this.initailizeJobLauncherTestUtils();
}
with this you can control for which Job should JobLauncherTestUtils be applied. (by default it expects single Job configuration in context)