### Question:
ScheduleServiceImpl implements ScheduleService { @Override public boolean updateJob(JobRequest jobRequest) { JobKey jobKey = null; Trigger newTrigger; try { newTrigger = JobUtils.createTrigger(jobRequest); jobKey = JobKey.jobKey(jobRequest.getJobName(), jobRequest.getGroupName()); Date dt = schedulerFactoryBean.getScheduler().rescheduleJob(TriggerKey.triggerKey(jobRequest.getJobName()), newTrigger); log.debug("Job with jobKey : {} rescheduled successfully at date : {}", jobKey, dt); jobHistoryService.updateJob(jobKey); return true; } catch (SchedulerException e) { log.error("error occurred while scheduling with jobKey : {}", jobKey, e); } return false; }  @Override boolean addJob(JobRequest jobRequest, Class<? extends Job> jobClass); @Override boolean deleteJob(JobKey jobKey); @Override boolean updateJob(JobRequest jobRequest); @Override boolean pauseJob(JobKey jobKey); @Override boolean resumeJob(JobKey jobKey); @Override boolean stopJob(JobKey jobKey); @Override StatusResponse getAllJobs(); @Override boolean isJobRunning(JobKey jobKey); @Override boolean isJobExists(JobKey jobKey); @Override String getJobState(JobKey jobKey);  }### Answer:
@Test public void updateJob() throws SchedulerException { JobKey jobKey = new JobKey(testJobName, testGroupName); JobRequest jobRequest = new JobRequest(); jobRequest.setCronExpression("0/10 * * ? * *"); jobRequest.setJobName(testJobName); jobRequest.setGroupName(testGroupName); JobStatus jobStatus = new JobStatus(); when(jobHistoryService.updateJob(jobKey)).thenReturn(jobStatus); when(schedulerFactoryBean.getScheduler()).thenReturn(scheduler); when(scheduler.rescheduleJob(anyObject(), anyObject())).thenReturn(new Date()); boolean result = scheduleService.updateJob(jobRequest); assertThat(result).isTrue(); verify(jobHistoryService).updateJob(jobKey); verify(schedulerFactoryBean).getScheduler(); verify(scheduler).rescheduleJob(anyObject(), anyObject()); }