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(),
                "Expected a " + exceptionClass.getSimpleName() + " exception, but got " +
                    cause.getClass().getSimpleName());
        }
    }
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