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

        val authentication = RegisteredServiceTestUtils.getAuthentication("casuser");
        val tokenId = UUID.randomUUID().toString();
        val service = RegisteredServiceTestUtils.getService();
        try (val webServer = new MockWebServer(port,
            new ByteArrayResource(tokenId.getBytes(StandardCharsets.UTF_8), "Output"), HttpStatus.OK)) {
            webServer.start();
            val token = multifactorAuthenticationService.generate(authentication.getPrincipal(), service);
            assertEquals(token.getId(), tokenId);
            assertEquals(token.getService(), service);
        }

        try (val webServer = new MockWebServer(port,
            new ByteArrayResource(tokenId.getBytes(StandardCharsets.UTF_8), "Output"), HttpStatus.INTERNAL_SERVER_ERROR)) {
            webServer.start();
            assertThrows(FailedLoginException.class, () -> multifactorAuthenticationService.generate(authentication.getPrincipal(), service));
        }
    }
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