@Test
    void verifyReleasesAttributes() throws Throwable {
        val filter = new AttributeQueryAttributeReleasePolicy();
        filter.setAllowedAttributes(CollectionUtils.wrapList("uid", "cn"));
        val registeredService = SamlIdPTestUtils.getSamlRegisteredService();
        registeredService.setAttributeReleasePolicy(filter);
        val service = CoreAuthenticationTestUtils.getService("https://sp.testshib.org/shibboleth-sp");
        service.getAttributes().put("owner", List.of(SamlAttributeQueryTicket.class.getName()));
        val principal = CoreAuthenticationTestUtils.getPrincipal("casuser");

        val context = RegisteredServiceAttributeReleasePolicyContext.builder()
            .registeredService(registeredService)
            .applicationContext(applicationContext)
            .service(service)
            .principal(principal)
            .build();
        assertTrue(filter.supports(context));
        val attributes = filter.getAttributes(context);
        assertTrue(attributes.containsKey("uid"));
        assertTrue(attributes.containsKey("cn"));
    }
This is {@link AttributeQueryAttributeReleasePolicyTests}.

@author Misagh Moayyed
@since 6.5.0
support/cas-server-support-saml-idp/src/test/java/org/apereo/cas/support/saml/services/AttributeQueryAttributeReleasePolicyTests.java