JobService { public void killJob(final String jobId) { stopJob(jobId, DEAD); jobRepository.appendMessage( jobId, jobMessage(WARNING, "Job didn't receive updates for a while, considering it dead", now(clock)) ); } JobService();   JobService(final JobRepository jobRepository,
               final JobMetaService jobMetaService,
               final List<JobRunnable> jobRunnables,
               final ScheduledExecutorService executor,
               final ApplicationEventPublisher applicationEventPublisher,
               final Clock clock,
               final SystemInfo systemInfo,
               final UuidProvider uuidProvider); @PostConstruct void postConstruct(); Optional<String> startAsyncJob(String jobType); Optional<JobInfo> findJob(final String id); List<JobInfo> findJobs(final Optional<String> type, final int count); List<JobInfo> findJobsDistinct(); void deleteJobs(final Optional<String> type); void stopJob(final String jobId); void killJobsDeadSince(final int seconds); void killJob(final String jobId); void appendMessage(final String jobId,
                              final JobMessage jobMessage); void keepAlive(final String jobId); void markSkipped(final String jobId); void markRestarted(final String jobId); void handleTooBigJobLogs();  }
@Test public void shouldKillJob() { OffsetDateTime now = OffsetDateTime.now(clock); JobInfo jobInfo = JobInfo.newJobInfo("superId", "superType", clock, HOSTNAME); when(jobRepository.findOne("superId")).thenReturn(Optional.of(jobInfo)); jobService.killJob("superId"); JobInfo expected = jobInfo.copy().setStatus(JobInfo.JobStatus.DEAD).setStopped(now).setLastUpdated(now).build(); verify(jobMetaService).releaseRunLock("superType"); verify(jobRepository).createOrUpdate(expected); }