@VisibleForTesting
    static void createDocumentationFile(
            String title,
            DocumentingRestEndpoint restEndpoint,
            RestAPIVersion apiVersion,
            Path outputFile)
            throws IOException {
        final OpenAPI openApi = createDocumentation(title, restEndpoint, apiVersion);
        Files.deleteIfExists(outputFile);
        Files.write(outputFile, Yaml.pretty(openApi).getBytes(StandardCharsets.UTF_8));
    }
@Test
    void testExcludeFromDocumentation(@TempDir Path tmpDir) throws Exception {
        final Path file = tmpDir.resolve("openapi_spec.yaml");
        OpenApiSpecGenerator.createDocumentationFile(
                "title",
                DocumentingRestEndpoint.forRestHandlerSpecifications(
                        new TestEmptyMessageHeaders("/test/empty1", "This is a testing REST API."),
                        new TestEmptyMessageHeaders(
                                "/test/empty2", "This is another testing REST API."),
                        new TestExcludeMessageHeaders(
                                "/test/exclude1",
                                "This REST API should not appear in the generated documentation."),
                        new TestExcludeMessageHeaders(
                                "/test/exclude2",
                                "This REST API should also not appear in the generated documentation.")),
                RuntimeRestAPIVersion.V0,
                file);
        final String actual = new String(Files.readAllBytes(file), StandardCharsets.UTF_8);

        assertThat(actual).contains("/test/empty1");
        assertThat(actual).contains("This is a testing REST API.");
        assertThat(actual).contains("/test/empty2");
        assertThat(actual).contains("This is another testing REST API.");
        assertThat(actual).doesNotContain("/test/exclude1");
        assertThat(actual)
                .doesNotContain("This REST API should not appear in the generated documentation.");
        assertThat(actual).doesNotContain("/test/exclude2");
        assertThat(actual)
                .doesNotContain(
                        "This REST API should also not appear in the generated documentation.");
    }