@Test
public void shouldFindLatestByType() {

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