@Test
    void verifyOperation() throws Throwable {
        var document = new SamlIdPMetadataDocument();
        var entity = MAPPER.writeValueAsString(document);
        try (val webServer = new MockWebServer(9453,
            new ByteArrayResource(entity.getBytes(StandardCharsets.UTF_8), "Output"), HttpStatus.OK)) {
            webServer.start();
            assertNotNull(samlIdPMetadataGenerator.generate(Optional.empty()));
        }

        document.setEncryptionCertificate(UUID.randomUUID().toString());
        document.setSigningKey(UUID.randomUUID().toString());
        document.setSigningCertificate(UUID.randomUUID().toString());
        document.setEncryptionKey(UUID.randomUUID().toString());
        document.setMetadata(UUID.randomUUID().toString());

        entity = MAPPER.writeValueAsString(document);
        try (val webServer = new MockWebServer(9453,
            new ByteArrayResource(entity.getBytes(StandardCharsets.UTF_8), "Output"), HttpStatus.OK)) {
            webServer.start();
            val service = new SamlRegisteredService();
            service.setName("TestShib");
            service.setId(1000);
            assertNotNull(samlIdPMetadataGenerator.generate(Optional.of(service)));
        }

        try (val webServer = new MockWebServer(9453,
            new ByteArrayResource("___".getBytes(StandardCharsets.UTF_8), "Output"), HttpStatus.OK)) {
            webServer.start();
            assertNotNull(samlIdPMetadataGenerator.generate(Optional.empty()));
        }
    }
This is {@link RestfulSamlIdPMetadataGeneratorTests}.

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