@Test
    void verifyChainedResolver() throws Throwable {
        val resolver = PersonDirectoryPrincipalResolver.newPersonDirectoryPrincipalResolver(
            applicationContext, PrincipalFactoryUtils.newPrincipalFactory(),
            attributeRepository,
            CoreAuthenticationUtils.getAttributeMerger(casProperties.getAuthn().getAttributeRepository().getCore().getMerger()),
            servicesManager, attributeDefinitionStore,
            attributeRepositoryResolver, casProperties.getPersonDirectory());
        val chain = new ChainingPrincipalResolver(new DefaultPrincipalElectionStrategy(), tenantExtractor,
            List.of(new EchoingPrincipalResolver(), resolver), casProperties);
        val attributes = new HashMap<String, List<Object>>(2);
        attributes.put("a1", List.of("v1"));
        attributes.put("a2", List.of("v2"));
        val resolve = chain.resolve(new UsernamePasswordCredential("admin", "password"),
            Optional.of(CoreAuthenticationTestUtils.getPrincipal("admin", attributes)),
            Optional.of(new SimpleTestUsernamePasswordAuthenticationHandler()),
            Optional.of(CoreAuthenticationTestUtils.getService()));
        assertNotNull(resolve);
        assertTrue(resolve.getAttributes().containsKey("cn"));
        assertTrue(resolve.getAttributes().containsKey("a1"));
        assertTrue(resolve.getAttributes().containsKey("a2"));
    }
This is {@link PersonDirectoryPrincipalResolverLdapTests}.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-ldap/src/test/java/org/apereo/cas/authentication/PersonDirectoryPrincipalResolverLdapTests.java