@Test
    public void verifyGet() throws Exception {
        val restBody = IOUtils.toString(
            new ClassPathResource("sample-sp-metadata.xml").getInputStream(), StandardCharsets.UTF_8);
        val wireMockServer = new WireMockServer(8087);
        wireMockServer.stubFor(
            get(urlPathEqualTo("/saml"))
                .willReturn(aResponse()
                    .withStatus(200)
                    .withHeader("Content-Type", ContentType.APPLICATION_XML.getMimeType())
                    .withBody(restBody)));
        wireMockServer.start();
        try {
            val configuration = initialConfiguration();
            final SAML2MetadataGenerator metadataGenerator =
                new SAML2HttpUrlMetadataGenerator(new URL("http://localhost:8087/saml"), new SAML2HttpClientBuilder().build());
            val resolver = metadataGenerator.buildMetadataResolver();
            assertNotNull(resolver);

            var entity = resolver.resolveSingle(
                new CriteriaSet(new EntityIdCriterion(configuration.getServiceProviderEntityId())));
            assertNotNull(entity);
        } finally {
            wireMockServer.stop();
        }
    }
This is {@link SAML2HttpUrlMetadataGeneratorTests}.

@author Misagh Moayyed
pac4j-saml/src/test/java/org/pac4j/saml/metadata/SAML2HttpUrlMetadataGeneratorTests.java