Jiabao-Sun commented on code in PR #23960:
URL: https://github.com/apache/flink/pull/23960#discussion_r1496035741


##########
flink-core/src/test/java/org/apache/flink/api/common/io/FileInputFormatTest.java:
##########
@@ -28,205 +28,218 @@
 import org.apache.flink.core.fs.FileSystem;
 import org.apache.flink.core.fs.Path;
 import org.apache.flink.testutils.TestFileUtils;
+import org.apache.flink.testutils.junit.utils.TempDirUtils;
 import org.apache.flink.types.IntValue;
 
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;

Review Comment:
   ```suggestion
   import static org.assertj.core.api.Assertions.assertThatThrownBy;
   ```



##########
flink-core/src/test/java/org/apache/flink/api/common/functions/util/RuntimeUDFContextTest.java:
##########
@@ -24,200 +24,156 @@
 import org.apache.flink.api.common.functions.BroadcastVariableInitializer;
 import org.apache.flink.metrics.groups.UnregisteredMetricsGroup;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;

Review Comment:
   ```suggestion
   import static org.assertj.core.api.Assertions.assertThatThrownBy;
   ```



##########
flink-core/src/test/java/org/apache/flink/api/common/accumulators/DoubleMinimumTest.java:
##########
@@ -18,65 +18,66 @@
 
 package org.apache.flink.api.common.accumulators;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.AssertionsForClassTypes.within;

Review Comment:
   ```suggestion
   import static org.assertj.core.api.Assertions.within;
   ```



##########
flink-core/src/test/java/org/apache/flink/api/common/accumulators/AverageAccumulatorTest.java:
##########
@@ -18,71 +18,70 @@
 
 package org.apache.flink.api.common.accumulators;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
+import static org.assertj.core.api.AssertionsForClassTypes.within;

Review Comment:
   ```suggestion
   import static org.assertj.core.api.Assertions.assertThatThrownBy;
   import static org.assertj.core.api.Assertions.within;
   ```



##########
flink-core/src/test/java/org/apache/flink/api/common/io/FileInputFormatTest.java:
##########
@@ -28,205 +28,218 @@
 import org.apache.flink.core.fs.FileSystem;
 import org.apache.flink.core.fs.Path;
 import org.apache.flink.testutils.TestFileUtils;
+import org.apache.flink.testutils.junit.utils.TempDirUtils;
 import org.apache.flink.types.IntValue;
 
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
+import static org.assertj.core.api.Fail.fail;
+
 /** Tests for the FileInputFormat */
-public class FileInputFormatTest {
+class FileInputFormatTest {
 
-    @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    @TempDir private java.nio.file.Path temporaryFolder;
 
     @Test
-    public void testGetPathWithoutSettingFirst() {
+    void testGetPathWithoutSettingFirst() {
         final DummyFileInputFormat format = new DummyFileInputFormat();
-        Assert.assertNull("Path should be null.", format.getFilePath());
+        assertThat(format.getFilePath()).as("Path should be null.").isNull();
     }
 
     @Test
-    public void testGetPathsWithoutSettingFirst() {
+    void testGetPathsWithoutSettingFirst() {
         final DummyFileInputFormat format = new DummyFileInputFormat();
 
         Path[] paths = format.getFilePaths();
-        Assert.assertNotNull("Paths should not be null.", paths);
-        Assert.assertEquals("Paths size should be 0.", 0, paths.length);
+        assertThat(paths).as("Paths should not be null.").isNotNull();
+        assertThat(paths.length).as("Paths should be empty.").isZero();

Review Comment:
   ```suggestion
           assertThat(paths).as("Paths should be empty.").isEmpty();
   ```



##########
flink-core/src/test/java/org/apache/flink/api/common/io/FileInputFormatTest.java:
##########
@@ -28,205 +28,218 @@
 import org.apache.flink.core.fs.FileSystem;
 import org.apache.flink.core.fs.Path;
 import org.apache.flink.testutils.TestFileUtils;
+import org.apache.flink.testutils.junit.utils.TempDirUtils;
 import org.apache.flink.types.IntValue;
 
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;

Review Comment:
   ```suggestion
   import static org.assertj.core.api.Assertions.assertThatThrownBy;
   ```



##########
flink-core/src/test/java/org/apache/flink/api/common/eventtime/WatermarksWithIdlenessTest.java:
##########
@@ -21,85 +21,94 @@
 import 
org.apache.flink.api.common.eventtime.WatermarksWithIdleness.IdlenessTimer;
 import org.apache.flink.util.clock.ManualClock;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.time.Duration;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;

Review Comment:
   ```suggestion
   import static org.assertj.core.api.Assertions.assertThatThrownBy;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to