Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,7 @@ void testCreatingMultipleGroups() {
+ " <td>This is example description for the first option.</td>\n"
+ " </tr>\n"
+ " </tbody>\n"
+ "</table>\n");

assertThat(tablesConverted)
+ "</table>\n")
.containsEntry(
"secondGroup",
"<table class=\"configuration table table-bordered\">\n"
Expand All @@ -389,9 +387,7 @@ void testCreatingMultipleGroups() {
+ " <td>This is long example description for the second option.</td>\n"
+ " </tr>\n"
+ " </tbody>\n"
+ "</table>\n");

assertThat(tablesConverted)
+ "</table>\n")
.containsEntry(
"default",
"<table class=\"configuration table table-bordered\">\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ void testExcludeFromDocumentation(@TempDir Path tmpDir) throws Exception {
"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);
final String actual = Files.readString(file);

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)
.contains(
"/test/empty1",
"This is a testing REST API.",
"/test/empty2",
"This is another testing REST API.")
.doesNotContain(
"/test/exclude1",
"This REST API should not appear in the generated documentation.",
"/test/exclude2",
"This REST API should also not appear in the generated documentation.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
import org.apache.flink.runtime.rest.messages.EmptyRequestBody;
import org.apache.flink.runtime.rest.util.DocumentingRestEndpoint;
import org.apache.flink.runtime.rest.versioning.RuntimeRestAPIVersion;
import org.apache.flink.util.FileUtils;

import org.junit.jupiter.api.Test;

import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

import static org.assertj.core.api.Assertions.assertThat;

Expand All @@ -38,7 +38,7 @@ class RestAPIDocGeneratorTest {

@Test
void testExcludeFromDocumentation() throws Exception {
File file = File.createTempFile("rest_v0_", ".html");
Path filePath = File.createTempFile("rest_v0_", ".html").toPath();
RestAPIDocGenerator.createHtmlFile(
DocumentingRestEndpoint.forRestHandlerSpecifications(
new TestEmptyMessageHeaders("/test/empty1", "This is a testing REST API."),
Expand All @@ -51,19 +51,19 @@ void testExcludeFromDocumentation() throws Exception {
"/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);
filePath);
String actual = Files.readString(filePath);

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)
.contains(
"/test/empty1",
"This is a testing REST API.",
"/test/empty2",
"This is another testing REST API.")
.doesNotContain(
"/test/exclude1",
"This REST API should not appear in the generated documentation.",
"/test/exclude2",
"This REST API should also not appear in the generated documentation.");
}

Expand Down