### Question:
ScheduleServiceImpl implements ScheduleService { @Override public boolean isJobRunning(JobKey jobKey) { try { List<JobExecutionContext> currentJobs = schedulerFactoryBean.getScheduler().getCurrentlyExecutingJobs(); if (currentJobs != null) { for (JobExecutionContext jobCtx : currentJobs) { if (jobKey.getName().equals(jobCtx.getJobDetail().getKey().getName())) { return true; } } } } catch (SchedulerException e) { log.error("[schedulerdebug] error occurred while checking job 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 isJobRunning() throws SchedulerException { JobKey jobKey = new JobKey(testJobName, testGroupName); List<JobExecutionContext> currentJobs = new ArrayList<>(); JobExecutionContext jobExecutionContext = new JobExecutionContextImpl( scheduler, new TriggerFiredBundle(new JobDetailImpl(testJobName, testGroupName, MockJob.class), new CronTriggerImpl(testJobName), null, false, null, null, null, null), new MockJob()); currentJobs.add(jobExecutionContext); when(schedulerFactoryBean.getScheduler()).thenReturn(scheduler); when(scheduler.getCurrentlyExecutingJobs()).thenReturn(currentJobs); boolean result = scheduleService.isJobRunning(jobKey); assertThat(result).isTrue(); verify(schedulerFactoryBean).getScheduler(); verify(scheduler).getCurrentlyExecutingJobs(); }