@Test
    void verifyRestEndpointProducesMetadata() throws Throwable {
        val service = new SamlRegisteredService();
        service.setName("SAML Wiki Service");
        service.setServiceId("https://carmenwiki.osu.edu/shibboleth");
        service.setDescription("Testing");
        service.setMetadataLocation("rest://");
        assertTrue(resolver.supports(service));
        assertFalse(resolver.supports(null));
        assertFalse(resolver.isAvailable(service));
        assertFalse(resolver.isAvailable(null));

        val doc = new SamlMetadataDocument();
        doc.setId(1);
        doc.setName("SAML Document");
        doc.setSignature(null);
        doc.setValue(IOUtils.toString(new ClassPathResource("sp-metadata.xml").getInputStream(), StandardCharsets.UTF_8));
        val entity = MAPPER.writeValueAsString(doc);

        try (val webServer = new MockWebServer(8078,
            new ByteArrayResource(entity.getBytes(StandardCharsets.UTF_8), "Output"), HttpStatus.OK)) {
            webServer.start();
            assertTrue(resolver.isAvailable(service));
            val resolvers = resolver.resolve(service);
            assertEquals(1, resolvers.size());
        }

        try (val webServer = new MockWebServer(8078,
            new ByteArrayResource("@$@".getBytes(StandardCharsets.UTF_8), "Output"), HttpStatus.OK)) {
            webServer.start();
            val resolvers = resolver.resolve(service);
            assertEquals(0, resolvers.size());
        }
    }
This is {@link RestfulSamlRegisteredServiceMetadataResolverTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-saml-idp-metadata-rest/src/test/java/org/apereo/cas/support/saml/metadata/resolver/RestfulSamlRegisteredServiceMetadataResolverTests.java