private SamlRegisteredServiceDefaultCachingMetadataResolver getResolver(final String duration) {
        val resolutionPlan = new DefaultSamlRegisteredServiceMetadataResolutionPlan();
        val props = casProperties.getAuthn().getSamlIdp();
        resolutionPlan.registerMetadataResolver(
            new UrlResourceMetadataResolver(httpClient, props, openSamlConfigBean));
        resolutionPlan.registerMetadataResolver(
            new MetadataQueryProtocolMetadataResolver(httpClient, props, openSamlConfigBean));
        resolutionPlan.registerMetadataResolver(
            new ClasspathResourceMetadataResolver(props, openSamlConfigBean));
        val cacheLoader = new SamlRegisteredServiceMetadataResolverCacheLoader(openSamlConfigBean, httpClient, resolutionPlan);
        casProperties.getAuthn().getSamlIdp().getMetadata().getCore().setCacheExpiration(duration);
        return new SamlRegisteredServiceDefaultCachingMetadataResolver(casProperties, cacheLoader, openSamlConfigBean);
    }
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