@Test
public void shouldAppendErrorMessageAndSetErrorStatus() {

    OffsetDateTime now = OffsetDateTime.now(clock);
    OffsetDateTime earlier = now.minus(10, MINUTES);
    JobMessage message = JobMessage.jobMessage(Level.ERROR, "Error: Out of hunk", now);
    JobInfo jobInfo = defaultJobInfo()
            .setLastUpdated(earlier)
            .build();
    when(jobRepository.findOne(JOB_ID)).thenReturn(Optional.of(jobInfo));
    // when
    jobService.appendMessage(JOB_ID, message);
    // then
    verify(jobRepository).appendMessage(JOB_ID, message);
    verify(jobRepository).setJobStatus(JOB_ID, JobInfo.JobStatus.ERROR);
}