@Test
    void verifyOnlyRelease() {
        val policy = new DefaultAuthenticationAttributeReleasePolicy(Set.of("cn", "authnContext"),
            Set.of(), "authnContext");
        val service = CoreAuthenticationTestUtils.getRegisteredService();
        val attrPolicy = new ReturnAllowedAttributeReleasePolicy();
        when(service.getAttributeReleasePolicy()).thenReturn(attrPolicy);
        val results = policy.getAuthenticationAttributesForRelease(
            CoreAuthenticationTestUtils.getAuthentication(CoreAuthenticationTestUtils.getPrincipal(),
                Map.of("cn", List.of("common-name"), "givenName", List.of("given-name"))),
            mock(Assertion.class), Map.of("authnContext", List.of("mfa-something")), service);
        assertEquals(2, results.size());
        assertTrue(results.containsKey("cn"));
        assertTrue(results.containsKey("authnContext"));
    }
This is {@link DefaultAuthenticationAttributeReleasePolicyTests}.

@author Misagh Moayyed
@since 6.3.0
core/cas-server-core-authentication-attributes/src/test/java/org/apereo/cas/authentication/DefaultAuthenticationAttributeReleasePolicyTests.java