@Test
    void verifyAction() throws Throwable {
        val entity = MAPPER.writeValueAsString(CoreAuthenticationTestUtils.getPrincipal("casuser"));
        try (val webServer = new MockWebServer(entity)) {
            webServer.start();

            val props = new RestEndpointProperties();
            props.setUrl("http://localhost:%s".formatted(webServer.getPort()));
            val factory = PrincipalFactoryUtils.newRestfulPrincipalFactory(props);
            val p = factory.createPrincipal("casuser", CollectionUtils.wrap("name", List.of("CAS")));
            assertEquals("casuser", p.getId());
            assertEquals(5, p.getAttributes().size());
        }
    }
This is {@link RestfulPrincipalFactoryTests}.

@author Misagh Moayyed
@since 5.3.0
core/cas-server-core-authentication-api/src/test/java/org/apereo/cas/authentication/RestfulPrincipalFactoryTests.java