@Test
    void verifyInMemoryXmlMetadata() throws Throwable {
        val content = IOUtils.toString(new ClassPathResource("sample-sp.xml").getInputStream(), StandardCharsets.UTF_8);
        val metadataResolver = mock(SamlRegisteredServiceMetadataResolver.class);
        when(metadataResolver.supports(any())).thenReturn(Boolean.TRUE);
        when(metadataResolver.isAvailable(any())).thenReturn(Boolean.TRUE);
        when(metadataResolver.resolve(any())).thenCallRealMethod();
        when(metadataResolver.resolve(any(SamlRegisteredService.class), any(CriteriaSet.class)))
            .thenAnswer(e -> List.of(new InMemoryResourceMetadataResolver(content, openSamlConfigBean)));
        val loader = buildCacheLoader(metadataResolver);
        val service = new SamlRegisteredService();
        service.setName(RandomUtils.randomAlphabetic(4));
        service.setId(RandomUtils.nextLong());
        service.setServiceId("https://example.org/saml");
        service.setMetadataLocation(UUID.randomUUID().toString());
        val key = new SamlRegisteredServiceCacheKey(service, new CriteriaSet());
        assertNotNull(loader.load(key));
    }
This is {@link SamlRegisteredServiceMetadataResolverCacheLoaderTests}.

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