@Test
    void verifyPolicyWithMappedAttributes() throws Throwable {
        val data = MAPPER.writeValueAsString(CollectionUtils.wrap("givenName", "CASUSER"));
        try (val webServer = new MockWebServer(
            new ByteArrayResource(data.getBytes(StandardCharsets.UTF_8), "REST Output"), MediaType.APPLICATION_JSON_VALUE)) {
            webServer.start();
            val policyWritten = new ReturnRestfulAttributeReleasePolicy()
                .setEndpoint("http://localhost:%s".formatted(webServer.getPort()))
                .setAllowedAttributes(Map.of("givenName", List.of("givenName1", "givenName2")));

            val releasePolicyContext = RegisteredServiceAttributeReleasePolicyContext.builder()
                .registeredService(CoreAuthenticationTestUtils.getRegisteredService())
                .service(CoreAuthenticationTestUtils.getService())
                .principal(CoreAuthenticationTestUtils.getPrincipal())
                .applicationContext(applicationContext)
                .build();
            val attributes = policyWritten.getAttributes(releasePolicyContext);
            assertEquals(2, attributes.size());
            assertTrue(attributes.containsKey("givenName1"));
            assertTrue(attributes.containsKey("givenName2"));
        }
    }
This is {@link ReturnRestfulAttributeReleasePolicyTests}.

@author Misagh Moayyed
@since 5.3.0
core/cas-server-core-authentication-attributes/src/test/java/org/apereo/cas/services/ReturnRestfulAttributeReleasePolicyTests.java