@Test
    public void testError() {
        FutureRecordMetadata future = new FutureRecordMetadata(asyncRequest(baseOffset, new CorruptRecordException(), 50L),
                relOffset, RecordBatch.NO_TIMESTAMP, 0, 0, Time.SYSTEM);
        assertThrows(ExecutionException.class, future::get);
    }
Test that an asynchronous request will eventually throw the right exception
clients/src/test/java/org/apache/kafka/clients/producer/RecordSendTest.java