@Test
    void verifyValidateTokenFails() throws Throwable {
        val props = casProperties.getAuthn().getMfa().getSimple().getToken().getRest();
        val port = URI.create(props.getUrl()).getPort();

        val authentication = RegisteredServiceTestUtils.getAuthentication("casuser");
        try (val webServer = new MockWebServer(port,
            new ByteArrayResource(MAPPER.writeValueAsString(authentication.getPrincipal())
                .getBytes(StandardCharsets.UTF_8), "Output"), HttpStatus.INTERNAL_SERVER_ERROR)) {
            webServer.start();
            val credential = new CasSimpleMultifactorTokenCredential(UUID.randomUUID().toString());
            assertThrows(FailedLoginException.class, () -> multifactorAuthenticationService.validate(authentication.getPrincipal(), credential));
        }
    }
This is {@link RestfulCasSimpleMultifactorAuthenticationServiceTests}.

@author Misagh Moayyed
@since 6.6.0
support/cas-server-support-simple-mfa/src/test/java/org/apereo/cas/mfa/simple/validation/RestfulCasSimpleMultifactorAuthenticationServiceTests.java