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());
    }
Assert that a future raises an expected exception cause type. Return the exception cause
if the assertion succeeds; otherwise raise AssertionError.

@param future The future to await
@param exceptionCauseClass Class of the expected exception cause
@param <T> Exception cause type parameter
@return The caught exception cause
clients/src/test/java/org/apache/kafka/test/TestUtils.java