@VisibleForTesting
    static void createHtmlFile(
            DocumentingRestEndpoint restEndpoint, RestAPIVersion apiVersion, Path outputFile)
            throws IOException {
        final StringBuilder html = new StringBuilder();
        restEndpoint.getSpecs().stream()
                .filter(spec -> spec.getSupportedAPIVersions().contains(apiVersion))
                .filter(ApiSpecGeneratorUtils::shouldBeDocumented)
                .map(RestAPIDocGenerator::createHtmlEntry)
                .forEach(html::append);
        Files.deleteIfExists(outputFile);
        Files.write(outputFile, html.toString().getBytes(StandardCharsets.UTF_8));
    }
@Test
    void testExcludeFromDocumentation() throws Exception {
        File file = File.createTempFile("rest_v0_", ".html");
        RestAPIDocGenerator.createHtmlFile(
                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.toPath());
        String actual = FileUtils.readFile(file, StandardCharsets.UTF_8);

        assertThat(actual).containsSequence("/test/empty1");
        assertThat(actual).containsSequence("This is a testing REST API.");
        assertThat(actual).containsSequence("/test/empty2");
        assertThat(actual).containsSequence("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.");
    }