@Test
    void testMultipleAttributeKeys() {
        val cacheMap = new HashMap<Serializable, Set<PersonAttributes>>();

        val keyAttrs = new HashSet<String>();
        keyAttrs.add("name.first");
        keyAttrs.add("name.last");

        var dao = new CachingPersonAttributeDaoImpl();
        dao.setCachedPersonAttributesDao(stubDao);
        var cacheKeyGenerator = new AttributeBasedCacheKeyGenerator();
        cacheKeyGenerator.setCacheKeyAttributes(keyAttrs);
        dao.setCacheKeyGenerator(cacheKeyGenerator);
        dao.setUserInfoCache(cacheMap);
        dao.afterPropertiesSet();

        assertEquals(0, cacheMap.size());

        var result = dao.getPerson("edalquist");
        assertNull(result);
        assertEquals(0, cacheMap.size());

        result = dao.getPerson("nobody");
        assertNull(result);
        assertEquals(0, cacheMap.size());

        result = dao.getPerson("edalquist");
        assertNull(result);
        assertEquals(0, cacheMap.size());

        val queryMap1 = new HashMap<String, List<Object>>();
        queryMap1.put(DEFAULT_ATTR, List.of("edalquist"));
        queryMap1.put("name.first", List.of("Eric"));
        queryMap1.put("name.last", List.of("Dalquist"));

        var resultSet = dao.getPeopleWithMultivaluedAttributes(queryMap1);
        assertEquals(1, resultSet.size());
        validateUser1(resultSet.iterator().next().getAttributes());
        assertEquals(1, cacheMap.size());

        val queryMap2 = new HashMap<String, Object>();
        queryMap2.put("name.first", List.of("John"));
        queryMap2.put("name.last", List.of("Doe"));

        resultSet = dao.getPeople(queryMap2);
        assertNull(resultSet);
        assertEquals(1, cacheMap.size());


        resultSet = dao.getPeopleWithMultivaluedAttributes(queryMap1);
        assertEquals(1, resultSet.size());
        validateUser1(resultSet.iterator().next().getAttributes());
        assertEquals(1, cacheMap.size());
    }
This is {@link CachingPersonAttributeDaoTests}.

@author Misagh Moayyed
@since 7.1.0
support/cas-server-support-person-directory-core/src/test/java/org/apereo/cas/persondir/CachingPersonAttributeDaoTests.java