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


##########
flink-core/src/test/java/org/apache/flink/api/common/eventtime/WatermarkOutputMultiplexerTest.java:
##########
@@ -44,12 +39,12 @@ public void singleImmediateWatermark() {
 
         watermarkOutput.emitWatermark(new Watermark(0));
 
-        assertThat(underlyingWatermarkOutput.lastWatermark(), 
is(watermark(0)));
-        assertThat(underlyingWatermarkOutput.isIdle(), is(false));
+        MatcherAssert.assertThat(underlyingWatermarkOutput.lastWatermark(), 
watermark(0));

Review Comment:
   ```suggestion
           
assertThat(underlyingWatermarkOutput.lastWatermark()).isEqualTo(watermark(0));
   ```



##########
flink-core/src/test/java/org/apache/flink/api/common/eventtime/WatermarkOutputMultiplexerTest.java:
##########
@@ -109,15 +104,15 @@ public void 
whenImmediateOutputBecomesIdleWatermarkAdvances() {
         watermarkOutput1.emitWatermark(new Watermark(2));
         watermarkOutput2.emitWatermark(new Watermark(5));
 
-        assertThat(underlyingWatermarkOutput.lastWatermark(), 
is(watermark(2)));
+        MatcherAssert.assertThat(underlyingWatermarkOutput.lastWatermark(), 
watermark(2));
 
         watermarkOutput1.markIdle();
 
-        assertThat(underlyingWatermarkOutput.lastWatermark(), 
is(watermark(5)));
+        MatcherAssert.assertThat(underlyingWatermarkOutput.lastWatermark(), 
watermark(5));

Review Comment:
   same as above



##########
flink-core/src/test/java/org/apache/flink/api/common/io/DefaultFilterTest.java:
##########
@@ -19,50 +19,47 @@
 
 import org.apache.flink.core.fs.Path;
 
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import lombok.Getter;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import java.util.Arrays;
-import java.util.Collection;
+import java.util.List;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
-@RunWith(Parameterized.class)

Review Comment:
   ParameterizedTestExtension is preferred.



##########
flink-core/src/test/java/org/apache/flink/api/common/operators/ResourceSpecTest.java:
##########
@@ -222,61 +227,60 @@ public void testSubtract() {
                         .build();
 
         final ResourceSpec subtracted = rs1.subtract(rs2);
-        assertEquals(new CPUResource(0.8), subtracted.getCpuCores());
-        assertEquals(0, subtracted.getTaskHeapMemory().getMebiBytes());
-        assertEquals(
-                new ExternalResource(EXTERNAL_RESOURCE_NAME, 0.6),
-                subtracted.getExtendedResource(EXTERNAL_RESOURCE_NAME).get());
+        assertThat(subtracted.getCpuCores()).isEqualTo(new CPUResource(0.8));
+        assertThat(subtracted.getTaskHeapMemory().getMebiBytes()).isEqualTo(0);
+        
assertThat(subtracted.getExtendedResource(EXTERNAL_RESOURCE_NAME).get())
+                .isEqualTo(new ExternalResource(EXTERNAL_RESOURCE_NAME, 0.6));
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testSubtractOtherHasLargerResources() {
+    @Test
+    void testSubtractOtherHasLargerResources() {
         final ResourceSpec rs1 = ResourceSpec.newBuilder(1.0, 100).build();
         final ResourceSpec rs2 = ResourceSpec.newBuilder(0.2, 200).build();
 
-        rs1.subtract(rs2);
+        assertThatThrownBy(() -> 
rs1.subtract(rs2)).isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void testSubtractThisUnknown() {
+    void testSubtractThisUnknown() {
         final ResourceSpec rs1 = ResourceSpec.UNKNOWN;
         final ResourceSpec rs2 =
                 ResourceSpec.newBuilder(0.2, 100)
                         .setExtendedResource(new 
ExternalResource(EXTERNAL_RESOURCE_NAME, 0.5))
                         .build();
 
         final ResourceSpec subtracted = rs1.subtract(rs2);
-        assertEquals(ResourceSpec.UNKNOWN, subtracted);
+        assertThat(subtracted).isEqualTo(ResourceSpec.UNKNOWN);
     }
 
     @Test
-    public void testSubtractOtherUnknown() {
+    void testSubtractOtherUnknown() {
         final ResourceSpec rs1 =
                 ResourceSpec.newBuilder(1.0, 100)
                         .setExtendedResource(new 
ExternalResource(EXTERNAL_RESOURCE_NAME, 1.1))
                         .build();
         final ResourceSpec rs2 = ResourceSpec.UNKNOWN;
 
         final ResourceSpec subtracted = rs1.subtract(rs2);
-        assertEquals(ResourceSpec.UNKNOWN, subtracted);
+        assertThat(subtracted).isEqualTo(ResourceSpec.UNKNOWN);
     }
 
     @Test
-    public void testZeroExtendedResourceFromConstructor() {
+    void testZeroExtendedResourceFromConstructor() {
         final ResourceSpec resourceSpec =
                 ResourceSpec.newBuilder(1.0, 100)
                         .setExtendedResource(new 
ExternalResource(EXTERNAL_RESOURCE_NAME, 0))
                         .build();
-        assertEquals(resourceSpec.getExtendedResources().size(), 0);
+        assertThat(0).isEqualTo(resourceSpec.getExtendedResources().size());
     }
 
     @Test
-    public void testZeroExtendedResourceFromSubtract() {
+    void testZeroExtendedResourceFromSubtract() {
         final ResourceSpec resourceSpec =
                 ResourceSpec.newBuilder(1.0, 100)
                         .setExtendedResource(new 
ExternalResource(EXTERNAL_RESOURCE_NAME, 1.0))
                         .build();
 
-        
assertEquals(resourceSpec.subtract(resourceSpec).getExtendedResources().size(), 
0);

Review Comment:
   isEmpty



##########
flink-core/src/test/java/org/apache/flink/api/common/typeinfo/TypeHintTest.java:
##########
@@ -56,14 +55,14 @@ public void testTypeInfoDirect() {
                         BasicTypeInfo.DOUBLE_TYPE_INFO,
                         BasicTypeInfo.BOOLEAN_TYPE_INFO);
 
-        assertEquals(tupleInfo, generic.getTypeInfo());
+        assertThat(generic.getTypeInfo()).isEqualTo(tupleInfo);
     }
 
     @Test
-    public <T> void testWithGenericParameter() {
+    <T> void testWithGenericParameter() {
         try {
             new TypeHint<T>() {};
-            fail();
+            fail("");

Review Comment:
   assertThatThrownBy()



##########
flink-core/src/test/java/org/apache/flink/api/common/io/DelimitedInputFormatTest.java:
##########
@@ -107,27 +103,27 @@ public void testSerialization() throws Exception {
         @SuppressWarnings("unchecked")
         DelimitedInputFormat<String> deserialized = 
(DelimitedInputFormat<String>) ois.readObject();
 
-        assertEquals(NUM_LINE_SAMPLES, deserialized.getNumLineSamples());
-        assertEquals(LINE_LENGTH_LIMIT, deserialized.getLineLengthLimit());
-        assertEquals(BUFFER_SIZE, deserialized.getBufferSize());
-        assertArrayEquals(DELIMITER, deserialized.getDelimiter());
+        
assertThat(deserialized.getNumLineSamples()).isEqualTo(NUM_LINE_SAMPLES);
+        
assertThat(deserialized.getLineLengthLimit()).isEqualTo(LINE_LENGTH_LIMIT);
+        assertThat(deserialized.getBufferSize()).isEqualTo(BUFFER_SIZE);
+        assertThat(deserialized.getDelimiter()).isEqualTo(DELIMITER);
     }
 
     @Test
-    public void testOpen() throws IOException {
+    void testOpen() throws IOException {
         final String myString = "my mocked line 1\nmy mocked line 2\n";
         final FileInputSplit split = createTempFile(myString);
 
         int bufferSize = 5;
         format.setBufferSize(bufferSize);
         format.open(split);
-        assertEquals(0, format.splitStart);
-        assertEquals(myString.length() - bufferSize, format.splitLength);
-        assertEquals(bufferSize, format.getBufferSize());
+        assertThat(format.splitStart).isEqualTo(0);

Review Comment:
   ```suggestion
           assertThat(format.splitStart).isZero();
   ```



##########
flink-core/src/test/java/org/apache/flink/api/common/io/EnumerateNestedFilesTest.java:
##########
@@ -94,21 +95,21 @@ public void testOneNestedDirectoryTrue() {
             format.configure(this.config);
 
             FileInputSplit[] splits = format.createInputSplits(1);
-            Assert.assertEquals(3, splits.length);
+            assertThat(splits.length).isEqualTo(3);

Review Comment:
   hasSize



##########
flink-core/src/test/java/org/apache/flink/api/common/eventtime/WatermarkOutputMultiplexerTest.java:
##########
@@ -58,29 +53,29 @@ public void singleImmediateIdleness() {
 
         watermarkOutput.markIdle();
 
-        assertThat(underlyingWatermarkOutput.lastWatermark(), nullValue());
-        assertThat(underlyingWatermarkOutput.isIdle(), is(true));
+        assertThat(underlyingWatermarkOutput.lastWatermark()).isNull();
+        assertThat(underlyingWatermarkOutput.isIdle()).isEqualTo(true);
     }
 
     @Test
-    public void singleImmediateWatermarkAfterIdleness() {
+    void singleImmediateWatermarkAfterIdleness() {
         TestingWatermarkOutput underlyingWatermarkOutput = 
createTestingWatermarkOutput();
         WatermarkOutputMultiplexer multiplexer =
                 new WatermarkOutputMultiplexer(underlyingWatermarkOutput);
 
         WatermarkOutput watermarkOutput = createImmediateOutput(multiplexer);
 
         watermarkOutput.markIdle();
-        assertThat(underlyingWatermarkOutput.isIdle(), is(true));
+        assertThat(underlyingWatermarkOutput.isIdle()).isEqualTo(true);

Review Comment:
   ```suggestion
           assertThat(underlyingWatermarkOutput.isIdle()).isTrue();
   ```



##########
flink-core/src/test/java/org/apache/flink/api/common/eventtime/WatermarkOutputMultiplexerTest.java:
##########
@@ -93,12 +88,12 @@ public void multipleImmediateWatermark() {
         watermarkOutput2.emitWatermark(new Watermark(5));
         watermarkOutput3.markIdle();
 
-        assertThat(underlyingWatermarkOutput.lastWatermark(), 
is(watermark(2)));
-        assertThat(underlyingWatermarkOutput.isIdle(), is(false));
+        MatcherAssert.assertThat(underlyingWatermarkOutput.lastWatermark(), 
watermark(2));
+        assertThat(underlyingWatermarkOutput.isIdle()).isEqualTo(false);

Review Comment:
   same as above



##########
flink-core/src/test/java/org/apache/flink/api/common/eventtime/WatermarkOutputMultiplexerTest.java:
##########
@@ -58,29 +53,29 @@ public void singleImmediateIdleness() {
 
         watermarkOutput.markIdle();
 
-        assertThat(underlyingWatermarkOutput.lastWatermark(), nullValue());
-        assertThat(underlyingWatermarkOutput.isIdle(), is(true));
+        assertThat(underlyingWatermarkOutput.lastWatermark()).isNull();
+        assertThat(underlyingWatermarkOutput.isIdle()).isEqualTo(true);
     }
 
     @Test
-    public void singleImmediateWatermarkAfterIdleness() {
+    void singleImmediateWatermarkAfterIdleness() {
         TestingWatermarkOutput underlyingWatermarkOutput = 
createTestingWatermarkOutput();
         WatermarkOutputMultiplexer multiplexer =
                 new WatermarkOutputMultiplexer(underlyingWatermarkOutput);
 
         WatermarkOutput watermarkOutput = createImmediateOutput(multiplexer);
 
         watermarkOutput.markIdle();
-        assertThat(underlyingWatermarkOutput.isIdle(), is(true));
+        assertThat(underlyingWatermarkOutput.isIdle()).isEqualTo(true);
 
         watermarkOutput.emitWatermark(new Watermark(0));
 
-        assertThat(underlyingWatermarkOutput.lastWatermark(), 
is(watermark(0)));
-        assertThat(underlyingWatermarkOutput.isIdle(), is(false));
+        MatcherAssert.assertThat(underlyingWatermarkOutput.lastWatermark(), 
watermark(0));
+        assertThat(underlyingWatermarkOutput.isIdle()).isEqualTo(false);

Review Comment:
   ```suggestion
           
assertThat(underlyingWatermarkOutput.lastWatermark()).isEqualTo(watermark(0));
           assertThat(underlyingWatermarkOutput.isIdle()).isFalse();
   ```



##########
flink-core/src/test/java/org/apache/flink/api/common/io/FileOutputFormatTest.java:
##########
@@ -53,14 +53,14 @@ public void testCreateNonParallelLocalFS() throws 
IOException {
         try {
             dfof.open(0, 1);
             dfof.close();
-            fail();
+            fail("");

Review Comment:
   assertThatThrownBy()



##########
flink-core/src/test/java/org/apache/flink/api/common/io/EnumerateNestedFilesTest.java:
##########
@@ -121,23 +122,23 @@ public void testOneNestedDirectoryFalse() {
             format.configure(this.config);
 
             FileInputSplit[] splits = format.createInputSplits(1);
-            Assert.assertEquals(1, splits.length);
+            assertThat(splits.length).isEqualTo(1);

Review Comment:
   hasSize



##########
flink-core/src/test/java/org/apache/flink/api/common/ExecutionConfigFromConfigurationTest.java:
##########
@@ -20,23 +20,19 @@
 
 import org.apache.flink.configuration.Configuration;
 
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.function.BiConsumer;
 import java.util.function.Consumer;
 import java.util.function.Function;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
 
-@RunWith(Parameterized.class)

Review Comment:
   How about `ParameterizedTestExtension`?



##########
flink-core/src/test/java/org/apache/flink/api/common/operators/ExpressionKeysTest.java:
##########
@@ -111,19 +115,19 @@ public void testStandardTupleKeys() {
                             ints.length); // copy, just to make sure that the 
code is not cheating
             // by changing the ints.
             ek = new ExpressionKeys<>(inInts, typeInfo);
-            Assert.assertArrayEquals(ints, ek.computeLogicalKeyPositions());
-            Assert.assertEquals(ints.length, 
ek.computeLogicalKeyPositions().length);
+            assertThat(ek.computeLogicalKeyPositions()).isEqualTo(ints);
+            
assertThat(ek.computeLogicalKeyPositions().length).isEqualTo(ints.length);

Review Comment:
   hasSameSizeAs



##########
flink-core/src/test/java/org/apache/flink/api/common/io/FileOutputFormatTest.java:
##########
@@ -72,7 +72,7 @@ public void testCreateNonParallelLocalFS() throws IOException 
{
         try {
             dfof.open(0, 1);
             dfof.close();
-            fail();
+            fail("");

Review Comment:
   assertThatThrownBy()



##########
flink-core/src/test/java/org/apache/flink/api/common/io/BinaryInputFormatTest.java:
##########
@@ -148,16 +149,16 @@ public void testGetStatisticsNonExistingFiles() {
     }
 
     @Test
-    public void testGetStatisticsMultiplePaths() throws IOException {
+    void testGetStatisticsMultiplePaths() throws IOException {
         final int blockInfoSize = new BlockInfo().getInfoSize();
         final int blockSize = blockInfoSize + 8;
         final int numBlocks1 = 3;
         final int numBlocks2 = 5;
 
         final File tempFile =
-                createBinaryInputFile("binary_input_format_test", blockSize, 
numBlocks1);
+                createBinaryInputFile("binary_input_format_test11", blockSize, 
numBlocks1);
         final File tempFile2 =
-                createBinaryInputFile("binary_input_format_test_2", blockSize, 
numBlocks2);
+                createBinaryInputFile("binary_input_format_test22", blockSize, 
numBlocks2);

Review Comment:
   Why we change the filename here?



##########
flink-core/src/test/java/org/apache/flink/api/common/io/FileOutputFormatTest.java:
##########
@@ -127,14 +127,14 @@ public void testCreateNonParallelLocalFS() throws 
IOException {
         try {
             dfof.open(0, 1);
             dfof.close();
-            fail();
+            fail("");

Review Comment:
   same as above



##########
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.").isEqualTo(0);
     }
 
     @Test
-    public void testToStringWithoutPathSet() {
+    void testToStringWithoutPathSet() {
         final DummyFileInputFormat format = new DummyFileInputFormat();
-        Assert.assertEquals(
-                "The toString() should be correct.",
-                "File Input (unknown file)",
-                format.toString());
+        assertThat(format.toString())
+                .as("The toString() should be correct.")
+                .isEqualTo("File Input (unknown file)");
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testSetPathsNull() {
-        final MultiDummyFileInputFormat format = new 
MultiDummyFileInputFormat();
-        format.setFilePaths((String) null);
+    @Test
+    void testSetPathsNull() {
+        assertThatThrownBy(() -> new 
MultiDummyFileInputFormat().setFilePaths((String) null))
+                .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testSetPathNullString() {
-        final DummyFileInputFormat format = new DummyFileInputFormat();
-        format.setFilePath((String) null);
+    @Test
+    void testSetPathNullString() {
+        assertThatThrownBy(() -> new 
DummyFileInputFormat().setFilePath((String) null))
+                .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testSetPathNullPath() {
-        final DummyFileInputFormat format = new DummyFileInputFormat();
-        format.setFilePath((Path) null);
+    @Test
+    void testSetPathNullPath() {
+        assertThatThrownBy(() -> new DummyFileInputFormat().setFilePath((Path) 
null))
+                .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testSetPathsOnePathNull() {
-        final MultiDummyFileInputFormat format = new 
MultiDummyFileInputFormat();
-        format.setFilePaths("/an/imaginary/path", null);
+    @Test
+    void testSetPathsOnePathNull() {
+        assertThatThrownBy(
+                        () ->
+                                new MultiDummyFileInputFormat()
+                                        .setFilePaths("/an/imaginary/path", 
null))
+                .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testSetPathsEmptyArray() {
-        final MultiDummyFileInputFormat format = new 
MultiDummyFileInputFormat();
-        format.setFilePaths(new String[0]);
+    @Test
+    void testSetPathsEmptyArray() {
+        assertThatThrownBy(() -> new 
MultiDummyFileInputFormat().setFilePaths(new String[0]))
+                .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void testSetPath() {
+    void testSetPath() {
         final DummyFileInputFormat format = new DummyFileInputFormat();
         format.setFilePath("/some/imaginary/path");
-        Assert.assertEquals(format.getFilePath().toString(), 
"/some/imaginary/path");
+        
assertThat("/some/imaginary/path").isEqualTo(format.getFilePath().toString());
     }
 
     @Test
-    public void testSetPathOnMulti() {
+    void testSetPathOnMulti() {
         final MultiDummyFileInputFormat format = new 
MultiDummyFileInputFormat();
         final String myPath = "/an/imaginary/path";
         format.setFilePath(myPath);
         final Path[] filePaths = format.getFilePaths();
 
-        Assert.assertEquals(1, filePaths.length);
-        Assert.assertEquals(myPath, filePaths[0].toUri().toString());
+        assertThat(filePaths.length).isEqualTo(1);

Review Comment:
   hasSize



##########
flink-core/src/test/java/org/apache/flink/api/common/serialization/AbstractDeserializationSchemaTest.java:
##########
@@ -26,85 +26,82 @@
 
 import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.util.JSONPObject;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import java.io.IOException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.fail;
 
 /** Tests for {@link AbstractDeserializationSchema}. */
-@SuppressWarnings("serial")
-public class AbstractDeserializationSchemaTest {
+class AbstractDeserializationSchemaTest {
 
     @Test
-    public void testTypeExtractionTuple() {
+    void testTypeExtractionTuple() {
         TypeInformation<Tuple2<byte[], byte[]>> type = new 
TupleSchema().getProducedType();
         TypeInformation<Tuple2<byte[], byte[]>> expected =
                 TypeInformation.of(new TypeHint<Tuple2<byte[], byte[]>>() {});
-        assertEquals(expected, type);
+        assertThat(type).isEqualTo(expected);
     }
 
     @Test
-    public void testTypeExtractionTupleAnonymous() {
+    void testTypeExtractionTupleAnonymous() {
         TypeInformation<Tuple2<byte[], byte[]>> type =
                 new AbstractDeserializationSchema<Tuple2<byte[], byte[]>>() {
                     @Override
-                    public Tuple2<byte[], byte[]> deserialize(byte[] message) 
throws IOException {
+                    public Tuple2<byte[], byte[]> deserialize(byte[] message) {
                         throw new UnsupportedOperationException();
                     }
                 }.getProducedType();
 
         TypeInformation<Tuple2<byte[], byte[]>> expected =
                 TypeInformation.of(new TypeHint<Tuple2<byte[], byte[]>>() {});
-        assertEquals(expected, type);
+        assertThat(type).isEqualTo(expected);
     }
 
     @Test
-    public void testTypeExtractionGeneric() {
+    void testTypeExtractionGeneric() {
         TypeInformation<JSONPObject> type = new JsonSchema().getProducedType();
         TypeInformation<JSONPObject> expected = TypeInformation.of(new 
TypeHint<JSONPObject>() {});
-        assertEquals(expected, type);
+        assertThat(type).isEqualTo(expected);
     }
 
     @Test
-    public void testTypeExtractionGenericAnonymous() {
+    void testTypeExtractionGenericAnonymous() {
         TypeInformation<JSONPObject> type =
                 new AbstractDeserializationSchema<JSONPObject>() {
                     @Override
-                    public JSONPObject deserialize(byte[] message) throws 
IOException {
+                    public JSONPObject deserialize(byte[] message) {
                         throw new UnsupportedOperationException();
                     }
                 }.getProducedType();
 
         TypeInformation<JSONPObject> expected = TypeInformation.of(new 
TypeHint<JSONPObject>() {});
-        assertEquals(expected, type);
+        assertThat(type).isEqualTo(expected);
     }
 
     @Test
-    public void testTypeExtractionRawException() {
+    void testTypeExtractionRawException() {
         try {
             new RawSchema();
-            fail();
+            fail("");

Review Comment:
   assertThatThrownBy



##########
flink-core/src/test/java/org/apache/flink/api/common/state/StateDescriptorTest.java:
##########
@@ -30,53 +30,49 @@
 import org.apache.flink.core.testutils.CheckedThread;
 import org.apache.flink.core.testutils.CommonTestUtils;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.io.File;
 import java.util.ArrayList;
 import java.util.concurrent.ConcurrentHashMap;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-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.Fail.fail;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 
 /** Tests for the common/shared functionality of {@link StateDescriptor}. */
-public class StateDescriptorTest {
+class StateDescriptorTest {
 
     // ------------------------------------------------------------------------
     //  Tests for serializer initialization
     // ------------------------------------------------------------------------
 
     @Test
-    public void testInitializeWithSerializer() throws Exception {
+    void testInitializeWithSerializer() throws Exception {
         final TypeSerializer<String> serializer = StringSerializer.INSTANCE;
         final TestStateDescriptor<String> descr = new 
TestStateDescriptor<>("test", serializer);
 
-        assertTrue(descr.isSerializerInitialized());
-        assertNotNull(descr.getSerializer());
-        assertTrue(descr.getSerializer() instanceof StringSerializer);
+        assertThat(descr.isSerializerInitialized()).isTrue();
+        assertThat(descr.getSerializer()).isNotNull();
+        assertInstanceOf(StringSerializer.class, descr.getSerializer());

Review Comment:
   same as above



##########
flink-core/src/test/java/org/apache/flink/api/common/io/FileOutputFormatTest.java:
##########
@@ -107,9 +107,9 @@ public void testCreateNonParallelLocalFS() throws 
IOException {
             dfof.open(0, 1);
             dfof.close();
         } catch (Exception e) {
-            fail();
+            fail("");

Review Comment:
   same as above



##########
flink-core/src/test/java/org/apache/flink/api/common/state/StateDescriptorTest.java:
##########
@@ -85,22 +81,22 @@ public void testInitializeSerializerBeforeSerialization() 
throws Exception {
 
         descr.initializeSerializerUnlessSet(new ExecutionConfig());
 
-        assertTrue(descr.isSerializerInitialized());
-        assertNotNull(descr.getSerializer());
-        assertTrue(descr.getSerializer() instanceof StringSerializer);
+        assertThat(descr.isSerializerInitialized()).isTrue();
+        assertThat(descr.getSerializer()).isNotNull();
+        assertInstanceOf(StringSerializer.class, descr.getSerializer());
 
         TestStateDescriptor<String> clone = 
CommonTestUtils.createCopySerializable(descr);
 
-        assertTrue(clone.isSerializerInitialized());
-        assertNotNull(clone.getSerializer());
-        assertTrue(clone.getSerializer() instanceof StringSerializer);
+        assertThat(clone.isSerializerInitialized()).isTrue();
+        assertThat(clone.getSerializer()).isNotNull();
+        assertInstanceOf(StringSerializer.class, clone.getSerializer());
     }
 
     @Test
-    public void testInitializeSerializerAfterSerialization() throws Exception {
+    void testInitializeSerializerAfterSerialization() throws Exception {
         final TestStateDescriptor<String> descr = new 
TestStateDescriptor<>("test", String.class);
 
-        assertFalse(descr.isSerializerInitialized());
+        assertThat(descr.isSerializerInitialized()).isFalse();
         try {
             descr.getSerializer();
             fail("should fail with an exception");

Review Comment:
   assertThatThrownBy



##########
flink-core/src/test/java/org/apache/flink/api/common/state/StateTtlConfigTest.java:
##########
@@ -87,7 +84,7 @@ public void 
testStateTtlConfigBuildWithNonPositiveCleanupIncrementalSize() {
                         StateTtlConfig.newBuilder(Time.seconds(1))
                                 .cleanupIncrementally(illegalCleanUpSize, 
false)
                                 .build();
-                Assert.fail();
+                fail("");

Review Comment:
   assertThatThrownBy()



##########
flink-core/src/test/java/org/apache/flink/api/common/state/ListStateDescriptorTest.java:
##########
@@ -25,44 +25,42 @@
 import org.apache.flink.api.java.typeutils.runtime.kryo.KryoSerializer;
 import org.apache.flink.core.testutils.CommonTestUtils;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.List;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 
 /** Tests for the {@link ListStateDescriptor}. */
-public class ListStateDescriptorTest {
+class ListStateDescriptorTest {
 
     @Test
-    public void testListStateDescriptor() throws Exception {
+    void testListStateDescriptor() throws Exception {
 
         TypeSerializer<String> serializer =
                 new KryoSerializer<>(String.class, new ExecutionConfig());
 
         ListStateDescriptor<String> descr = new 
ListStateDescriptor<>("testName", serializer);
 
-        assertEquals("testName", descr.getName());
-        assertNotNull(descr.getSerializer());
-        assertTrue(descr.getSerializer() instanceof ListSerializer);
-        assertNotNull(descr.getElementSerializer());
-        assertEquals(serializer, descr.getElementSerializer());
+        assertThat(descr.getName()).isEqualTo("testName");
+        assertThat(descr.getSerializer()).isNotNull();
+        assertInstanceOf(ListSerializer.class, descr.getSerializer());

Review Comment:
   ```suggestion
           assertThat(descr.getSerializer()).isInstanceOf(ListSerializer.class);
   ```



##########
flink-core/src/test/java/org/apache/flink/api/common/typeinfo/TypeInformationTest.java:
##########
@@ -23,50 +23,50 @@
 import org.apache.flink.api.java.typeutils.TupleTypeInfo;
 import org.apache.flink.util.FlinkRuntimeException;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.List;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Fail.fail;
 
 /** Tests for the {@link TypeInformation} class. */
-public class TypeInformationTest {
+class TypeInformationTest {
 
     @Test
-    public void testOfClass() {
-        assertEquals(BasicTypeInfo.STRING_TYPE_INFO, 
TypeInformation.of(String.class));
+    void testOfClass() {
+        
assertThat(TypeInformation.of(String.class)).isEqualTo(BasicTypeInfo.STRING_TYPE_INFO);
     }
 
     @Test
-    public void testOfGenericClassForFlink() {
+    void testOfGenericClassForFlink() {
         try {
             TypeInformation.of(Tuple3.class);
             fail("should fail with an exception");
         } catch (FlinkRuntimeException e) {
             // check that the error message mentions the TypeHint
-            assertNotEquals(-1, e.getMessage().indexOf("TypeHint"));
+            assertThat(e.getMessage().indexOf("TypeHint")).isNotEqualTo(-1);

Review Comment:
   ```java
   asssertThatThrownBy()
        .isInstanceOf(FlinkRuntimeException.class)
        .hasMessageContaining("TypeHint");
   ```



##########
flink-core/src/test/java/org/apache/flink/api/common/io/EnumerateNestedFilesTest.java:
##########
@@ -67,21 +68,21 @@ public void testNoNestedDirectoryTrue() {
             format.configure(this.config);
 
             FileInputSplit[] splits = format.createInputSplits(1);
-            Assert.assertEquals(1, splits.length);
+            assertThat(splits.length).isEqualTo(1);

Review Comment:
   hasSize



##########
flink-core/src/test/java/org/apache/flink/api/common/typeutils/SerializerTestBase.java:
##########
@@ -593,7 +600,7 @@ public void run() {
                         T copySerdeTestItem = serializer.copy(serdeTestItem);
                         dataOutputSerializer.clear();
 
-                        assertThat(
+                        MatcherAssert.assertThat(

Review Comment:
   assertThat



##########
flink-core/src/test/java/org/apache/flink/api/common/state/StateDescriptorTest.java:
##########
@@ -118,21 +114,21 @@ public void testInitializeSerializerAfterSerialization() 
throws Exception {
 
         clone.initializeSerializerUnlessSet(new ExecutionConfig());
 
-        assertTrue(clone.isSerializerInitialized());
-        assertNotNull(clone.getSerializer());
-        assertTrue(clone.getSerializer() instanceof StringSerializer);
+        assertThat(clone.isSerializerInitialized()).isTrue();
+        assertThat(clone.getSerializer()).isNotNull();
+        assertInstanceOf(StringSerializer.class, clone.getSerializer());

Review Comment:
   isInstanceOf()



-- 
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