@Test
public void testSaveIfNotExists() {

    UUID eventId = UUIDs.timeBased();
    UUID tenantId = UUIDs.timeBased();
    UUID entityId = UUIDs.timeBased();
    Event event = getEvent(eventId, tenantId, entityId);
    Optional<Event> optEvent1 = eventDao.saveIfNotExists(event);
    assertTrue("Optional is expected to be non-empty", optEvent1.isPresent());
    assertEquals(event, optEvent1.get());
    Optional<Event> optEvent2 = eventDao.saveIfNotExists(event);
    assertFalse("Optional is expected to be empty", optEvent2.isPresent());
}