@Test
    void verifyFailsExpiredToken() throws Throwable {
        val principal = RegisteredServiceTestUtils.getPrincipal();

        val factory = (CasSimpleMultifactorAuthenticationTicketFactory) defaultTicketFactory.get(CasSimpleMultifactorAuthenticationTicket.class);
        val ticket = factory.create(RegisteredServiceTestUtils.getService(),
            Map.of(CasSimpleMultifactorAuthenticationConstants.PROPERTY_PRINCIPAL, principal));
        ticketRegistry.addTicket(ticket);
        val credential = new CasSimpleMultifactorTokenCredential(ticket.getId());
        ticket.markTicketExpired();

        val mfaService = new DefaultCasSimpleMultifactorAuthenticationService(ticketRegistry, defaultTicketFactory, accountService);
        val handler = new CasSimpleMultifactorAuthenticationHandler(casProperties.getAuthn().getMfa().getSimple(),
            applicationContext, servicesManager, PrincipalFactoryUtils.newPrincipalFactory(), mfaService,
            new DirectObjectProvider<>(mock(MultifactorAuthenticationProvider.class)));
        assertThrows(MultifactorAuthenticationFailedException.class, () -> handler.authenticate(credential, mock(Service.class)));
    }
This is {@link CasSimpleMultifactorAuthenticationHandlerTests}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-simple-mfa/src/test/java/org/apereo/cas/mfa/simple/CasSimpleMultifactorAuthenticationHandlerTests.java