@Test
    void verifyAggregatedCacheLoading() throws Exception {
        val resolver = getResolver("PT5M");

        val service1 = getSamlRegisteredService(1, ".*", "classpath:aggregate-md.xml");
        assertNotNull(resolver.resolve(service1, getCriteriaFor("https://issues.shibboleth.net/shibboleth")));
        assertNotNull(resolver.resolve(service1, getCriteriaFor("https://mfa-auth.dev.phenoapp.com/Saml2")));
        assertNotNull(resolver.resolve(service1, getCriteriaFor("https://gitlab.com")));
        assertEquals(1, resolver.getCacheStatistics().loadSuccessCount());

        for (var i = 0; i < 5; i++) {
            val resource = new ClassPathResource("placeholder-sp.xml");
            val data = FileUtils.readFileToString(resource.getFile(), StandardCharsets.UTF_8)
                .replace("%ENTITY_ID%", "https://gitlab.com");
            val mdFile = Files.createTempFile("samplesp", ".xml").toFile();
            FileUtils.writeStringToFile(mdFile, data, StandardCharsets.UTF_8);
            val service2 = getSamlRegisteredService(i, ".*", "file://" + mdFile.getAbsolutePath());
            assertNotNull(resolver.resolve(service2, getCriteriaFor("https://gitlab.com")));
            assertEquals(1, resolver.getCacheStatistics().loadSuccessCount());
            assertTrue(mdFile.delete());
        }

    }
This is {@link SamlRegisteredServiceDefaultCachingMetadataResolverTests}.

@author Misagh Moayyed
@since 6.4.0
support/cas-server-support-saml-idp-metadata/src/test/java/org/apereo/cas/support/saml/services/idp/metadata/cache/SamlRegisteredServiceDefaultCachingMetadataResolverTests.java