@Test
public void testFindLatestByOriginatorAndType() throws ExecutionException, InterruptedException {

    System.out.println(System.currentTimeMillis());
    UUID tenantId = UUID.fromString("d4b68f40-3e96-11e7-a884-898080180d6b");
    UUID originator1Id = UUID.fromString("d4b68f41-3e96-11e7-a884-898080180d6b");
    UUID originator2Id = UUID.fromString("d4b68f42-3e96-11e7-a884-898080180d6b");
    UUID alarm1Id = UUID.fromString("d4b68f43-3e96-11e7-a884-898080180d6b");
    UUID alarm2Id = UUID.fromString("d4b68f44-3e96-11e7-a884-898080180d6b");
    UUID alarm3Id = UUID.fromString("d4b68f45-3e96-11e7-a884-898080180d6b");
    saveAlarm(alarm1Id, tenantId, originator1Id, "TEST_ALARM");
    saveAlarm(alarm2Id, tenantId, originator1Id, "TEST_ALARM");
    saveAlarm(alarm3Id, tenantId, originator2Id, "TEST_ALARM");
    assertEquals(3, alarmDao.find().size());
    ListenableFuture<Alarm> future = alarmDao
            .findLatestByOriginatorAndType(new TenantId(tenantId), new DeviceId(originator1Id), "TEST_ALARM");
    Alarm alarm = future.get();
    assertNotNull(alarm);
    assertEquals(alarm2Id, alarm.getId().getId());
}