@Test
    void verifyFilterWithScopeFreePolicyAndScopes() throws Throwable {
        val registeredService = getOidcRegisteredService(UUID.randomUUID().toString());
        val accessToken = mock(OAuth20AccessToken.class);
        when(accessToken.getTicketGrantingTicket()).thenReturn(new MockTicketGrantingTicket(UUID.randomUUID().toString()));
        when(accessToken.getScopes()).thenReturn(CollectionUtils.wrapSet(
            OidcConstants.StandardScopes.OPENID.getScope(),
            OidcConstants.StandardScopes.PHONE.getScope(),
            OidcConstants.StandardScopes.PROFILE.getScope(),
            OidcConstants.StandardScopes.ADDRESS.getScope(),
            OidcConstants.StandardScopes.EMAIL.getScope()));

        registeredService.setAttributeReleasePolicy(new ChainingAttributeReleasePolicy()
            .addPolicies(new OidcScopeFreeAttributeReleasePolicy(List.of("sys_id"))));
        val original = CoreAuthenticationTestUtils.getPrincipal(
            CollectionUtils.wrap(
                "sys_id", UUID.randomUUID().toString(),
                "email", "casuser@example.org",
                "address", "1234 Main Street",
                "phone", "123445677",
                "name", "CAS",
                "gender", "male"));
        val principal = profileScopeToAttributesFilter.filter(
            CoreAuthenticationTestUtils.getService(), original, registeredService, accessToken);
        val attributes = principal.getAttributes();
        assertTrue(attributes.containsKey("name"));
        assertTrue(attributes.containsKey("gender"));
        assertTrue(attributes.containsKey("email"));
        assertTrue(attributes.containsKey("sys_id"));
        assertEquals(4, attributes.size());
    }
This is {@link OidcProfileScopeToAttributesFilterTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-oidc/src/test/java/org/apereo/cas/oidc/profile/OidcProfileScopeToAttributesFilterTests.java