hgeraldino commented on code in PR #15506:
URL: https://github.com/apache/kafka/pull/15506#discussion_r1522194636


##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerSinkTaskTest.java:
##########
@@ -1215,17 +1195,13 @@ public void testSuppressCloseErrors() {
 
         workerTask.initialize(TASK_CONFIG);
         workerTask.initializeAndStart();
-        try {
-            workerTask.execute();
-            fail("workerTask.execute should have thrown an exception");
-        } catch (ConnectException e) {
-            assertSame("Exception from put should be the cause", putException, 
e.getCause());
-            assertTrue("Exception from close should be suppressed", 
e.getSuppressed().length > 0);
-            assertSame(closeException, e.getSuppressed()[0]);
-        }
+
+        Throwable thrownException = assertThrows(ConnectException.class, () -> 
workerTask.execute());
+        assertSame("Exception from put should be the cause", putException, 
thrownException.getCause());

Review Comment:
   This is a remnant of the original implementation. As you correctly guessed, 
there is no difference in this case between using `assertEquals` and 
`assertSame`: neither the `RuntimeException` class nor any of its parents 
override the `equals()` method, so they both are effectively checking for 
reference equality (as implemented by the base `Object` class)
   
   I'm happy to change these to `assertEquals` (this is the only place where 
this is used)



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to