@Test
    public void verifyPost() throws Exception {

        val wireMockServer = new WireMockServer(8088);
        wireMockServer.stubFor(
            post(urlPathEqualTo("/saml"))
                .withHeader("Accept", equalTo(ContentType.APPLICATION_XML.getMimeType()))
                .willReturn(aResponse()
                    .withStatus(200)
                    .withHeader("Content-Type", ContentType.APPLICATION_XML.getMimeType())));
        wireMockServer.start();
        try {
            SAML2MetadataGenerator metadataGenerator =
                new SAML2HttpUrlMetadataGenerator(new URL("http://localhost:8088/saml"), new SAML2HttpClientBuilder().build());
            val entity = metadataGenerator.buildEntityDescriptor();
            assertNotNull(entity);
            val metadata = metadataGenerator.getMetadata(entity);
            assertNotNull(metadata);
            assertTrue(metadataGenerator.storeMetadata(metadata, true));
        } finally {
            wireMockServer.stop();
        }
    }
This is {@link SAML2HttpUrlMetadataGeneratorTests}.

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