@Test
    void verifyAction() throws Throwable {
        val applicationContext = mock(ConfigurableApplicationContext.class);
        val ticketRegistry = newTicketRegistry();
        val tgt = new MockTicketGrantingTicket("casuser");
        tgt.setExpirationPolicy(new HardTimeoutExpirationPolicy(1));
        ticketRegistry.addTicket(tgt);
        assertEquals(1, ticketRegistry.getTickets().size());
        val cleaner = new DefaultTicketRegistryCleaner(LockRepository.noOp(), applicationContext, ticketRegistry);
        tgt.markTicketExpired();
        cleaner.clean();
        assertEquals(0, ticketRegistry.sessionCount());
        verify(applicationContext).publishEvent(any(CasRequestSingleLogoutEvent.class));
        verify(applicationContext).publishEvent(any(CasTicketGrantingTicketDestroyedEvent.class));
    }
This is {@link DefaultTicketRegistryCleanerTests}.

@author Misagh Moayyed
@since 5.3.0
core/cas-server-core-tickets/src/test/java/org/apereo/cas/ticket/registry/DefaultTicketRegistryCleanerTests.java