DefaultJobService implements JobService { @Override public Collection<JobExecution> getJobExecutions(final JobInstance jobInstance) { final Collection<JobExecution> jobExecutions = new LinkedList<>(); final List<JobExecution> jobExecutionList = this.jobExplorer.getJobExecutions(jobInstance); jobExecutions.addAll(jobExecutionList); return jobExecutions; } DefaultJobService(final JobOperator jobOperator,
                             final JobRegistry jobRegistry,
                             final JobExplorer jobExplorer,
                             final LightminJobExecutionDao lightminJobExecutionDao); @Override int getJobInstanceCount(final String jobName); @Override int getJobExecutionCount(final JobInstance jobInstance); @Override Set<String> getJobNames(); @Override Job getJobByName(final String jobName); @Override Collection<JobInstance> getJobInstances(final String jobName, final int startIndex, final int pageSize); @Override Collection<JobExecution> getJobExecutions(final JobInstance jobInstance); @Override Collection<JobExecution> getJobExecutions(final JobInstance jobInstance, final int start, final int count); @Override JobExecution getJobExecution(final Long jobExecutionId); @Override JobInstance getJobInstance(final Long jobInstanceId); @Override void attachJobInstance(final JobExecution jobExecution); @Override void restartJobExecution(final Long jobExecutionId); @Override void stopJobExecution(final Long jobExecutionId); @Override JobParameters getLastJobParameters(final String jobName); @Override void afterPropertiesSet();  }
@Test public void getJobExecutionsTest() { final JobInstance jobInstance = DomainTestHelper.createJobInstance(1l, JOB_NAME); when(this.jobExplorer.getJobExecutions(jobInstance)).thenReturn(DomainTestHelper.createJobExecutions(10)); final Collection<JobExecution> jobExecutions = this.jobService.getJobExecutions(jobInstance); assertThat(jobExecutions).isNotEmpty(); assertThat(jobExecutions.size()).isEqualTo(10); }
@Test public void getJobExecutionsPageTest() { final JobInstance jobInstance = DomainTestHelper.createJobInstance(1l, JOB_NAME); when(this.lightminJobExecutionDao.findJobExecutions(jobInstance, 1, 5)) .thenReturn(DomainTestHelper.createJobExecutions(5)); final Collection<JobExecution> jobExecutions = this.jobService.getJobExecutions(jobInstance, 1, 5); assertThat(jobExecutions).isNotEmpty(); assertThat(jobExecutions.size()).isEqualTo(5); }