@Test
public void shouldStopJob() {

    OffsetDateTime now = OffsetDateTime.now(clock);
    Clock earlierClock = offset(clock, Duration.of(-1, MINUTES));
    JobInfo jobInfo = JobInfo.newJobInfo("superId", "superType", earlierClock, HOSTNAME);
    when(jobRepository.findOne("superId")).thenReturn(Optional.of(jobInfo));
    jobService.stopJob("superId");
    JobInfo expected = jobInfo.copy().setStatus(JobInfo.JobStatus.OK).setStopped(now).setLastUpdated(now).build();
    verify(jobMetaService).releaseRunLock("superType");
    verify(jobRepository).createOrUpdate(expected);
}