@Test
    void verifyEncNameId() {
        val registeredService = getSamlRegisteredServiceForTestShib(true, false, true);
        registeredService.setEncryptionBlackListedAlgorithms(CollectionUtils.wrapArrayList("excludeAlg1"));
        registeredService.setEncryptionWhiteListedAlgorithms(CollectionUtils.wrapArrayList("includeAlg1"));
        registeredService.setWhiteListBlackListPrecedence("exclude");

        val adaptor = SamlRegisteredServiceMetadataAdaptor
            .get(samlRegisteredServiceCachingMetadataResolver, registeredService,
                registeredService.getServiceId()).get();

        val builder = new NameIDBuilder();
        val nameId = builder.buildObject();
        nameId.setValue(UUID.randomUUID().toString());
        nameId.setFormat(NameIDType.ENCRYPTED);
        val encNameId = samlIdPObjectEncrypter.encode(nameId, registeredService, adaptor);
        assertNotNull(encNameId);

        assertThrows(DecryptionException.class,
            () -> samlIdPObjectEncrypter.decode(encNameId, registeredService, adaptor));
    }
This is {@link SamlIdPObjectEncrypterTests}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-saml-idp/src/test/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/SamlIdPObjectEncrypterTests.java