@Test
        void verifySecurityQuestions() throws Throwable {
            val data = "{\"question1\":\"answer1\"}";
            try (val webServer = new MockWebServer(9308,
                new ByteArrayResource(data.getBytes(StandardCharsets.UTF_8), "REST Output"),
                MediaType.APPLICATION_JSON_VALUE)) {
                webServer.start();

                val props = new CasConfigurationProperties();
                val rest = props.getAuthn().getPm().getRest();
                rest.setEndpointUrlChange("http://localhost:9308");
                rest.setEndpointUrlSecurityQuestions("http://localhost:9308");
                rest.setEndpointUrlEmail("http://localhost:9308");
                val passwordService = getRestPasswordManagementService(props);

                val questions = passwordService.getSecurityQuestions(PasswordManagementQuery.builder().username("casuser").build());
                assertFalse(questions.isEmpty());
                assertTrue(questions.containsKey("question1"));
                webServer.stop();
            }

            try (val webServer = new MockWebServer(9090, HttpStatus.NO_CONTENT)) {
                webServer.start();
                assertNull(passwordChangeService.getSecurityQuestions(PasswordManagementQuery.builder().username("casuser").build()));
                webServer.stop();
            }
        }
This is {@link RestPasswordManagementServiceTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-pm-rest/src/test/java/org/apereo/cas/pm/rest/RestPasswordManagementServiceTests.java