@Test
public void shouldFindLatest() {

    // given
    repo.createOrUpdate(someRunningJobInfo("http://localhost/foo", "SOME_JOB", now()));
    final JobInfo later = someRunningJobInfo("http://localhost/bar", "SOME_JOB", now().plus(1, SECONDS));
    repo.createOrUpdate(later);
    final JobInfo evenLater = someRunningJobInfo("http://localhost/foobar", "SOME_JOB", now().plus(2, SECONDS));
    repo.createOrUpdate(evenLater);
    // when
    final List<JobInfo> jobInfos = repo.findLatest(2);
    // then
    assertThat(jobInfos, hasSize(2));
    assertThat(jobInfos, containsInAnyOrder(later, evenLater));
}