@Test
        void verifyDefaults() throws Throwable {
            val policy = new RegisteredServiceAttributeReleasePolicy() {
                @Serial
                private static final long serialVersionUID = 6118477243447737445L;

                @Override
                public RegisteredServicePrincipalAttributesRepository getPrincipalAttributesRepository() {
                    return new DefaultPrincipalAttributesRepository();
                }

                @Override
                public Map<String, List<Object>> getAttributes(final RegisteredServiceAttributeReleasePolicyContext context) {
                    return context.getPrincipal().getAttributes();
                }
            };
            assertNull(policy.getConsentPolicy());
            assertNotNull(policy.getPrincipalAttributesRepository());
            assertTrue(policy.isAuthorizedToReleaseAuthenticationAttributes());
            assertFalse(policy.isAuthorizedToReleaseCredentialPassword());
            assertFalse(policy.isAuthorizedToReleaseProxyGrantingTicket());
            assertEquals(0, policy.getOrder());

            val principal = PrincipalFactoryUtils.newPrincipalFactory()
                .createPrincipal("uid", Map.of("mail", List.of("final@example.com")));
            val context = RegisteredServiceAttributeReleasePolicyContext.builder()
                .registeredService(CoreAttributesTestUtils.getRegisteredService())
                .service(CoreAttributesTestUtils.getService())
                .applicationContext(applicationContext)
                .principal(principal)
                .build();
            val attrs = policy.getConsentableAttributes(context);
            assertEquals(principal.getAttributes(), attrs);

            assertDoesNotThrow(() -> policy.setAttributeFilter(null));

        }
Attribute filtering policy tests.

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