@Test
public void shouldFindLatestDistinct() throws Exception {

    // Given
    final OffsetDateTime now = OffsetDateTime.now();
    final JobInfo eins = someRunningJobInfo("http://localhost/eins", "someJobType", now);
    final JobInfo zwei = someRunningJobInfo("http://localhost/zwei", "someOtherJobType", now.plusSeconds(1));
    final JobInfo drei = someRunningJobInfo("http://localhost/drei", "nextJobType", now.plusSeconds(2));
    final JobInfo vier = someRunningJobInfo("http://localhost/vier", "someJobType", now.plusSeconds(3));
    final JobInfo fuenf = someRunningJobInfo("http://localhost/fuenf", "someJobType", now.plusSeconds(4));
    repo.createOrUpdate(eins);
    repo.createOrUpdate(zwei);
    repo.createOrUpdate(drei);
    repo.createOrUpdate(vier);
    repo.createOrUpdate(fuenf);
    // When
    final List<JobInfo> latestDistinct = repo.findLatestJobsDistinct();
    // Then
    assertThat(latestDistinct, hasSize(3));
    assertThat(latestDistinct, containsInAnyOrder(fuenf, zwei, drei));
}