@Test
    void verifyMatchByEntitiesGroup() throws Throwable {
        val filter = new MetadataEntityGroupAttributeReleasePolicy();
        filter.setGroup("urn:mace:.+");
        filter.setAllowedAttributes(List.of("sn"));

        val registeredService = SamlIdPTestUtils.getSamlRegisteredService();
        registeredService.setAttributeReleasePolicy(filter);
        val principal = CoreAuthenticationTestUtils.getPrincipal("casuser",
            CollectionUtils.wrap("eduPersonPrincipalName", "cas-eduPerson-user",
                "mail", "cas@example.org",
                "sn", "surname"));

        val context = RegisteredServiceAttributeReleasePolicyContext
            .builder()
            .registeredService(registeredService)
            .applicationContext(applicationContext)
            .service(CoreAuthenticationTestUtils.getService())
            .principal(principal)
            .build();

        val attributes = filter.getAttributes(context);
        assertEquals(1, attributes.size());
    }
This is {@link MetadataEntityGroupAttributeReleasePolicyTests}.

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