@Test
    protected void verifySave() throws Throwable {
        getEventRepository().removeAll();
        
        val dto1 = getCasEvent("casuser");
        getEventRepository().save(dto1);

        val dto2 = getCasEvent("casuser");
        getEventRepository().save(dto2);

        val col = getEventRepository().load().toList();
        assertEquals(2, col.size());

        assertNotEquals(dto2.getEventId(), dto1.getEventId(), "Created event IDs are equal but they should not be");

        val load2 = getEventRepository().load();
        val loadedEvents = load2.map(CasEvent::getEventId).distinct().toList();
        assertTrue(loadedEvents.stream().anyMatch(dto1.getEventId()::equals));
        assertTrue(loadedEvents.stream().anyMatch(dto2.getEventId()::equals));

        val load3 = getEventRepository().load();
        load3.forEach(event -> {
            assertFalse(event.getProperties().isEmpty());
            if (event.getEventId().equals(dto1.getEventId())) {
                assertEquals(dto1.getType(), event.getType());
                assertEquals(dto1.getTimestamp(), event.getTimestamp());
                assertEquals(dto1.getCreationTime().truncatedTo(ChronoUnit.SECONDS),
                    event.getCreationTime().truncatedTo(ChronoUnit.SECONDS));
                assertEquals(dto1.getPrincipalId(), event.getPrincipalId());
                assertEquals(dto1.getGeoLocation(), event.getGeoLocation());
                assertEquals(dto1.getClientIpAddress(), event.getClientIpAddress());
                assertEquals(dto1.getServerIpAddress(), event.getServerIpAddress());
            } else if (event.getEventId().equals(dto2.getEventId())) {
                assertEquals(dto2.getType(), event.getType());
                assertEquals(dto2.getTimestamp(), event.getTimestamp());
                assertEquals(dto2.getCreationTime().truncatedTo(ChronoUnit.SECONDS),
                    event.getCreationTime().truncatedTo(ChronoUnit.SECONDS));
                assertEquals(dto2.getPrincipalId(), event.getPrincipalId());
                assertEquals(dto2.getGeoLocation(), event.getGeoLocation());
                assertEquals(dto2.getClientIpAddress(), event.getClientIpAddress());
                assertEquals(dto2.getServerIpAddress(), event.getServerIpAddress());
            } else {
                fail("Unexpected event");
            }
        });
    }
This is {@link AbstractCasEventRepositoryTests}.

@author Misagh Moayyed
@since 5.0.0
core/cas-server-core-events/src/test/java/org/apereo/cas/support/events/AbstractCasEventRepositoryTests.java