@Test
        void checkServiceAttributeFilterByAttributeRepositoryId() throws Throwable {
            val policy = new ReturnAllAttributeReleasePolicy();
            val repository = new CachingPrincipalAttributesRepository(TimeUnit.MILLISECONDS.name(), 0);
            val principal = PrincipalFactoryUtils.newPrincipalFactory().createPrincipal("uid",
                Map.of("mail", List.of("final@example.com")));

            repository.setAttributeRepositoryIds(CollectionUtils.wrapSet("SampleStubRepository".toUpperCase(Locale.ENGLISH)));
            policy.setPrincipalAttributesRepository(repository);
            val context = RegisteredServiceAttributeReleasePolicyContext.builder()
                .registeredService(CoreAttributesTestUtils.getRegisteredService())
                .service(CoreAttributesTestUtils.getService())
                .applicationContext(applicationContext)
                .principal(principal)
                .build();
            var attr = policy.getAttributes(context);
            assertEquals(4, attr.size());

            repository.setAttributeRepositoryIds(CollectionUtils.wrapSet("DoesNotExist"));
            policy.setPrincipalAttributesRepository(repository);
            attr = policy.getAttributes(context);
            assertEquals(1, attr.size());
        }
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