chia7712 commented on code in PR #18296:
URL: https://github.com/apache/kafka/pull/18296#discussion_r1899690842


##########
clients/src/test/java/org/apache/kafka/test/TestUtils.java:
##########
@@ -583,19 +583,6 @@ public static <T extends Throwable> void 
assertFutureThrows(
         assertEquals(expectedMessage, receivedException.getMessage());
     }
 
-    public static void assertFutureError(Future<?> future, Class<? extends 
Throwable> exceptionClass)
-        throws InterruptedException {
-        try {
-            future.get();
-            fail("Expected a " + exceptionClass.getSimpleName() + " exception, 
but got success.");
-        } catch (ExecutionException ee) {
-            Throwable cause = ee.getCause();
-            assertEquals(exceptionClass, cause.getClass(),

Review Comment:
   > One additional detail, the new check is less strict - it allows the class 
or subclass while the old one only allowed the exact class. We should probably 
make the behavior configurable - if code expects an exact exception to be 
thrown, we should check for that.
   
   good point. Personally, I love the strict check. We could adjust 
`assertFutureThrows` to enforce this stricter behavior. While this might cause 
some existing tests to fail, I believe these failures should be relatively easy 
to address.



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