@Test
    void verifyOperationWithReplace() {
        chain.setMergingPolicy(PrincipalAttributesCoreProperties.MergingStrategyTypes.REPLACE);
        val service = CoreAuthenticationTestUtils.getService(UUID.randomUUID().toString());
        val registeredService = CoreAuthenticationTestUtils.getRegisteredService(service.getId());
        val releasePolicyContext = RegisteredServiceAttributeReleasePolicyContext.builder()
            .registeredService(registeredService)
            .service(service)
            .principal(CoreAuthenticationTestUtils.getPrincipal())
            .applicationContext(applicationContext)
            .build();
        val results = chain.getAttributes(releasePolicyContext);
        assertTrue(results.containsKey("givenName"));
        val values = CollectionUtils.toCollection(results.get("givenName"));
        assertEquals(1, values.size());
        assertEquals("CasUserPolicy2", values.iterator().next().toString());

        val repository = chain.getPrincipalAttributesRepository();
        assertInstanceOf(ChainingPrincipalAttributesRepository.class, repository);
        assertNotNull(repository.getAttributes(releasePolicyContext));
        assertDoesNotThrow(() -> repository.update(releasePolicyContext.getPrincipal().getId(),
            releasePolicyContext.getPrincipal().getAttributes(), releasePolicyContext));
    }
This is {@link ChainingAttributeReleasePolicyTests}.

@author Misagh Moayyed
@since 6.1.0
core/cas-server-core-authentication-attributes/src/test/java/org/apereo/cas/services/ChainingAttributeReleasePolicyTests.java