TaxCalculatorJobService implements JobService { @Override public void runTaxCalculatorJob(JobStartParams jobStartParams) { notifyJobStartListeners(); startJobs(jobStartParams.getYear(), jobStartParams.getMonth()); }  @Override void runTaxCalculatorJob(JobStartParams jobStartParams);  }
@Test public void onJobStarted_AllJobStartListenersAreNotified() { when(jobMock.getName()).thenReturn(A_JOBS_NAME); taxCalculatorJobService.runTaxCalculatorJob(new JobStartParams(YEAR, MONTH)); verify(jobStartListenerMock1).jobHasBeenStarted(A_JOBS_NAME); verify(jobStartListenerMock2).jobHasBeenStarted(A_JOBS_NAME); }
@Test public void whenStarJobs_withGivenYearAndMonth_runJobWithParameters() throws JobParametersInvalidException, JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException { taxCalculatorJobService.runTaxCalculatorJob(new JobStartParams(YEAR, MONTH)); verify(jobLauncherMock).run(any(Job.class), jobParametersArgumentCaptor.capture()); JobParameters jobParameters = jobParametersArgumentCaptor.getValue(); assertThat(jobParameters.getLong("year")).isEqualTo(YEAR); assertThat(jobParameters.getLong("month")).isEqualTo(MONTH); }