@Test
        void verifyAttributeFilterMappedAttributesIsCaseInsensitive() throws Throwable {
            val policy = new ReturnAllowedAttributeReleasePolicy();
            val attrs = new ArrayList<String>();
            attrs.add(ATTR_1);
            attrs.add(ATTR_2);

            policy.setAllowedAttributes(attrs);

            val p = mock(Principal.class);
            val map = new HashMap<String, List<Object>>();
            map.put("ATTR1", List.of(VALUE_1));
            map.put("ATTR2", List.of(VALUE_2));
            when(p.getAttributes()).thenReturn(map);
            when(p.getId()).thenReturn(PRINCIPAL_ID);

            val context = RegisteredServiceAttributeReleasePolicyContext.builder()
                .registeredService(CoreAttributesTestUtils.getRegisteredService())
                .service(CoreAttributesTestUtils.getService())
                .applicationContext(applicationContext)
                .principal(p)
                .build();
            val attr = policy.getAttributes(context);
            assertEquals(2, attr.size());
            assertTrue(attr.containsKey(ATTR_1));
            assertTrue(attr.containsKey(ATTR_2));
            assertTrue(policy.determineRequestedAttributeDefinitions(context).containsAll(policy.getAllowedAttributes()));
        }
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