snuyanzin commented on code in PR #106:
URL: 
https://github.com/apache/flink-connector-kafka/pull/106#discussion_r1650422938


##########
flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducerBaseTest.java:
##########
@@ -197,17 +197,9 @@ public void testAsyncErrorRethrownOnCheckpoint() throws 
Throwable {
                 .get(0)
                 .onCompletion(null, new Exception("artificial async 
exception"));
 
-        try {
-            testHarness.snapshot(123L, 123L);
-        } catch (Exception e) {
-            // the next invoke should rethrow the async exception
-            assertThat(e.getCause().getMessage()).contains("artificial async 
exception");
-
-            // test succeeded
-            return;
-        }
-
-        fail("unknown failure");
+        // the next invoke should rethrow the async exception
+        assertThatThrownBy(() -> testHarness.snapshot(123L, 123L))
+                .hasStackTraceContaining("artificial async exception");

Review Comment:
   same here



##########
flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducerBaseTest.java:
##########
@@ -261,27 +254,19 @@ public void go() throws Exception {
                 .onCompletion(null, new Exception("artificial async failure 
for 2nd message"));
         producer.getPendingCallbacks().get(2).onCompletion(null, null);
 
-        try {
-            snapshotThread.sync();
-        } catch (Exception e) {
-            // the snapshot should have failed with the async exception
-            assertThat(e.getCause().getMessage())
-                    .contains("artificial async failure for 2nd message");
-
-            // test succeeded
-            return;
-        }
-
-        fail("unknown failure");
+        // the snapshot should have failed with the async exception
+        assertThatThrownBy(() -> snapshotThread.sync())
+                .hasStackTraceContaining("artificial async failure for 2nd 
message");

Review Comment:
   same



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