wangzzu commented on code in PR #23233:
URL: https://github.com/apache/flink/pull/23233#discussion_r1302499459


##########
flink-runtime/src/test/java/org/apache/flink/runtime/operators/CrossTaskTest.java:
##########
@@ -244,19 +249,13 @@ public void testFailingStreamCrossTask() {
 
         final CrossDriver<Record, Record, Record> testTask = new 
CrossDriver<>();
 
-        try {
-            testDriver(testTask, MockFailingCrossStub.class);
-            Assert.fail("Exception not forwarded.");
-        } catch (ExpectedTestException etex) {
-            // good!
-        } catch (Exception e) {
-            e.printStackTrace();
-            Assert.fail("Test failed due to an exception.");
-        }
+        assertThatThrownBy(() -> testDriver(testTask, 
MockFailingCrossStub.class))
+                .withFailMessage("Exception not forwarded.")

Review Comment:
   same as above, you can check it globally



##########
flink-runtime/src/test/java/org/apache/flink/runtime/operators/CrossTaskTest.java:
##########
@@ -155,19 +162,13 @@ public void testFailingBlockCrossTask2() {
 
         final CrossDriver<Record, Record, Record> testTask = new 
CrossDriver<>();
 
-        try {
-            testDriver(testTask, MockFailingCrossStub.class);
-            Assert.fail("Exception not forwarded.");
-        } catch (ExpectedTestException etex) {
-            // good!
-        } catch (Exception e) {
-            e.printStackTrace();
-            Assert.fail("Test failed due to an exception.");
-        }
+        assertThatThrownBy(() -> testDriver(testTask, 
MockFailingCrossStub.class))
+                .withFailMessage("Exception not forwarded.")

Review Comment:
   i think this msg can remove



##########
flink-runtime/src/test/java/org/apache/flink/runtime/operators/JoinTaskTest.java:
##########
@@ -414,19 +415,13 @@ public void testFailingMatchTask() {
         addInput(new UniformRecordGenerator(keyCnt1, valCnt1, true));
         addInput(new UniformRecordGenerator(keyCnt2, valCnt2, true));
 
-        try {
-            testDriver(testTask, MockFailingMatchStub.class);
-            Assert.fail("Driver did not forward Exception.");
-        } catch (ExpectedTestException e) {
-            // good!
-        } catch (Exception e) {
-            e.printStackTrace();
-            Assert.fail("The test caused an exception.");
-        }
+        assertThatThrownBy(() -> testDriver(testTask, 
MockFailingMatchStub.class))
+                .withFailMessage("Driver did not forward Exception.")

Review Comment:
   same as above



##########
flink-runtime/src/test/java/org/apache/flink/runtime/operators/hash/MutableHashTableTestBase.java:
##########
@@ -122,14 +122,16 @@ public void testDifferentProbers() {
         AbstractHashTableProber<IntPair, IntPair> prober2 =
                 table.getProber(intPairComparator, pairComparator);
 
-        assertFalse(prober1 == prober2);
+        assertThat(prober1).isNotEqualTo(prober2);
 
         table.close(); // (This also tests calling close without calling open 
first.)
-        assertEquals("Memory lost", NUM_MEM_PAGES, 
table.getFreeMemory().size());
+        assertThat(table.getFreeMemory().size())
+                .withFailMessage("Memory lost")
+                .isEqualTo(NUM_MEM_PAGES);

Review Comment:
   `hasSize()`



##########
flink-runtime/src/test/java/org/apache/flink/runtime/operators/util/BitSetTest.java:
##########
@@ -19,17 +19,20 @@
 
 import org.apache.flink.core.memory.MemorySegment;
 import org.apache.flink.core.memory.MemorySegmentFactory;
+import 
org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameters;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import java.util.Arrays;
+import java.util.List;
 
-@RunWith(Parameterized.class)
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+@ExtendWith(ParameterizedTestExtension.class)
 public class BitSetTest {

Review Comment:
   `public` is not necessary



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to