@Test
    void verifyEncrypt() throws Throwable {
        val policy = new ReturnEncryptedAttributeReleasePolicy(CollectionUtils.wrapList("cn", "uid", "mail"));
        val registeredService = CoreAuthenticationTestUtils.getRegisteredService();
        val servicePublicKey = new RegisteredServicePublicKeyImpl("classpath:keys/RSA1024Public.key", "RSA");
        when(registeredService.getPublicKey()).thenReturn(servicePublicKey);
        val context = RegisteredServiceAttributeReleasePolicyContext.builder()
            .registeredService(registeredService)
            .applicationContext(applicationContext)
            .service(CoreAuthenticationTestUtils.getService())
            .principal(CoreAuthenticationTestUtils.getPrincipal("casuser"))
            .build();
        val results = policy.getAttributes(context);
        assertEquals(policy.getAllowedAttributes().size(), results.size());
    }
This is {@link ReturnEncryptedAttributeReleasePolicyTests}.

@author Misagh Moayyed
@since 6.2.0
core/cas-server-core-services/src/test/java/org/apereo/cas/services/ReturnEncryptedAttributeReleasePolicyTests.java