@Test
    void checkAttributesEncodedCorrectly() {
        val service = RegisteredServiceTestUtils.getService("testencryption");
        val encoder = new DefaultCasProtocolAttributeEncoder(this.servicesManager,
            RegisteredServicePublicKeyCipherExecutor.INSTANCE,
            CipherExecutor.noOpOfStringToString());
        val pgt = mock(Ticket.class);
        val pgtId = UUID.randomUUID().toString();
        when(pgt.getId()).thenReturn(pgtId);

        val encoded = encoder.encodeAttributes(Map.of(CasViewConstants.MODEL_ATTRIBUTE_NAME_PROXY_GRANTING_TICKET, pgt),
            this.attributes, servicesManager.findServiceBy(service), service);
        assertEquals(encoded.size(), this.attributes.size());
        checkEncryptedValues(CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL_CREDENTIAL, encoded);
        checkEncryptedValues(CasViewConstants.MODEL_ATTRIBUTE_NAME_PROXY_GRANTING_TICKET, encoded);
    }
This is test cases for {@link DefaultCasProtocolAttributeEncoder}.

@author Misagh Moayyed
@since 4.1
support/cas-server-support-person-directory/src/test/java/org/apereo/cas/DefaultCasAttributeEncoderTests.java