This is an automated email from the ASF dual-hosted git repository.
panyuepeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new ec90a33883e [hotfix][docs/test] Migrate the assertj assertion lines.
(#27879)
ec90a33883e is described below
commit ec90a33883ead9d5c85ea63a93231fcaa01f733e
Author: Yuepeng Pan <[email protected]>
AuthorDate: Thu Apr 2 22:31:24 2026 +0800
[hotfix][docs/test] Migrate the assertj assertion lines. (#27879)
Co-authored-by: Sergey Nuyanzin <[email protected]>
---
.../ConfigOptionsDocGeneratorTest.java | 8 ++-----
.../flink/docs/rest/OpenApiSpecGeneratorTest.java | 18 +++++++--------
.../flink/docs/rest/RestAPIDocGeneratorTest.java | 26 +++++++++++-----------
3 files changed, 24 insertions(+), 28 deletions(-)
diff --git
a/flink-docs/src/test/java/org/apache/flink/docs/configuration/ConfigOptionsDocGeneratorTest.java
b/flink-docs/src/test/java/org/apache/flink/docs/configuration/ConfigOptionsDocGeneratorTest.java
index df778abbd51..b7ce9f6f51d 100644
---
a/flink-docs/src/test/java/org/apache/flink/docs/configuration/ConfigOptionsDocGeneratorTest.java
+++
b/flink-docs/src/test/java/org/apache/flink/docs/configuration/ConfigOptionsDocGeneratorTest.java
@@ -367,9 +367,7 @@ class ConfigOptionsDocGeneratorTest {
+ " <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"
@@ -389,9 +387,7 @@ class ConfigOptionsDocGeneratorTest {
+ " <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"
diff --git
a/flink-docs/src/test/java/org/apache/flink/docs/rest/OpenApiSpecGeneratorTest.java
b/flink-docs/src/test/java/org/apache/flink/docs/rest/OpenApiSpecGeneratorTest.java
index 965fd35b272..8d6684a9e28 100644
---
a/flink-docs/src/test/java/org/apache/flink/docs/rest/OpenApiSpecGeneratorTest.java
+++
b/flink-docs/src/test/java/org/apache/flink/docs/rest/OpenApiSpecGeneratorTest.java
@@ -76,18 +76,18 @@ class OpenApiSpecGeneratorTest {
"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.");
}
diff --git
a/flink-docs/src/test/java/org/apache/flink/docs/rest/RestAPIDocGeneratorTest.java
b/flink-docs/src/test/java/org/apache/flink/docs/rest/RestAPIDocGeneratorTest.java
index b208f0ebc41..2b7e9bf83a8 100644
---
a/flink-docs/src/test/java/org/apache/flink/docs/rest/RestAPIDocGeneratorTest.java
+++
b/flink-docs/src/test/java/org/apache/flink/docs/rest/RestAPIDocGeneratorTest.java
@@ -24,12 +24,12 @@ import
org.apache.flink.docs.rest.data.TestExcludeMessageHeaders;
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;
@@ -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."),
@@ -51,19 +51,19 @@ class RestAPIDocGeneratorTest {
"/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.");
}