public static CasEvent createEvent(final String user, final int i,
                                       final CasEventRepository casEventRepository) throws Throwable {
        val dto = new CasEvent();
        dto.setType(CasTicketGrantingTicketCreatedEvent.class.getName());
        dto.putTimestamp(new Date().getTime());
        dto.setCreationTime(ZonedDateTime.now(ZoneOffset.UTC).minusDays(5).toInstant());
        dto.putEventId("TGT-" + i + '-' + RandomUtils.randomAlphanumeric(16));
        dto.setPrincipalId(user);
        dto.putClientIpAddress(getMockClientIpAddress());
        dto.putServerIpAddress("127.0.0.1");
        dto.putAgent(getMockUserAgent());
        dto.putGeoLocation(getMockGeoLocation());
        dto.putDeviceFingerprint(RandomUtils.randomAlphanumeric(16));
        dto.putTenant("CAS");
        casEventRepository.save(dto);
        return dto;
    }
This is {@link MockTicketGrantingTicketCreatedEventProducer}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-electrofence/src/test/java/org/apereo/cas/impl/mock/MockTicketGrantingTicketCreatedEventProducer.java