@Test
    void verifyPersonDirectoryOverrides() {
        val principal = new PersonDirectoryPrincipalResolverProperties();
        val personDirectory = new PersonDirectoryPrincipalResolverProperties();
        val principalResolutionContext = buildPrincipalResolutionContext(principal, personDirectory);
        assertFalse(principalResolutionContext.isUseCurrentPrincipalId());
        assertTrue(principalResolutionContext.isResolveAttributes());
        assertFalse(principalResolutionContext.isReturnNullIfNoAttributes());
        assertEquals(1, principalResolutionContext.getActiveAttributeRepositoryIdentifiers().size());
        assertTrue(principalResolutionContext.getActiveAttributeRepositoryIdentifiers().contains(PersonAttributeDao.WILDCARD));
        assertTrue(principalResolutionContext.getPrincipalAttributeNames().isEmpty());

        personDirectory.setUseExistingPrincipalId(TriStateBoolean.TRUE);
        personDirectory.setAttributeResolutionEnabled(TriStateBoolean.TRUE);
        personDirectory.setReturnNull(TriStateBoolean.TRUE);
        personDirectory.setAttributeResolutionEnabled(TriStateBoolean.FALSE);
        personDirectory.setActiveAttributeRepositoryIds("test1,test2");
        personDirectory.setPrincipalAttribute("principalAttribute");
        val principalResolutionContext2 = buildPrincipalResolutionContext(principal, personDirectory);
        assertTrue(principalResolutionContext2.isUseCurrentPrincipalId());
        assertFalse(principalResolutionContext2.isResolveAttributes());
        assertTrue(principalResolutionContext2.isReturnNullIfNoAttributes());
        assertEquals(3, principalResolutionContext2.getActiveAttributeRepositoryIdentifiers().size());
        assertEquals("principalAttribute", principalResolutionContext2.getPrincipalAttributeNames());

        principal.setUseExistingPrincipalId(TriStateBoolean.FALSE);
        principal.setAttributeResolutionEnabled(TriStateBoolean.FALSE);
        principal.setReturnNull(TriStateBoolean.FALSE);
        principal.setAttributeResolutionEnabled(TriStateBoolean.TRUE);
        principal.setActiveAttributeRepositoryIds("test1,test2,test3");
        principal.setPrincipalAttribute("principalAttribute2");
        val principalResolutionContext3 = buildPrincipalResolutionContext(principal, personDirectory);
        assertFalse(principalResolutionContext3.isUseCurrentPrincipalId());
        assertTrue(principalResolutionContext3.isResolveAttributes());
        assertFalse(principalResolutionContext3.isReturnNullIfNoAttributes());
        assertEquals(3, principalResolutionContext3.getActiveAttributeRepositoryIdentifiers().size());
        assertEquals("principalAttribute2", principalResolutionContext3.getPrincipalAttributeNames());

        val principalResolutionContext4 = buildPrincipalResolutionContext(personDirectory);
        assertTrue(principalResolutionContext4.isUseCurrentPrincipalId());
        assertFalse(principalResolutionContext4.isResolveAttributes());
        assertTrue(principalResolutionContext4.isReturnNullIfNoAttributes());
        assertEquals(2, principalResolutionContext4.getActiveAttributeRepositoryIdentifiers().size());
        assertEquals("principalAttribute", principalResolutionContext4.getPrincipalAttributeNames());
    }
Test cases for {@link PersonDirectoryPrincipalResolver}.

@author Misagh Moayyed
@since 4.2
support/cas-server-support-person-directory-core/src/test/java/org/apereo/cas/authentication/principal/resolvers/PersonDirectoryPrincipalResolverTests.java