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


##########
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:
   the replacement `assertFutureThrows` is using `assertThrows` and 
`assertInstanceOf`:
   ```java
       public static <T extends Throwable> T assertFutureThrows(Future<?> 
future, Class<T> exceptionCauseClass) {
           ExecutionException exception = 
assertThrows(ExecutionException.class, future::get);
           assertInstanceOf(exceptionCauseClass, exception.getCause(),
               "Unexpected exception cause " + exception.getCause());
           return exceptionCauseClass.cast(exception.getCause());
       }
   ```
   
   I think the `expected class` is already included by the error message.



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