@Test
    public void testBufferExhaustedExceptionIsThrown() throws Exception {
        BufferPool pool = new BufferPool(2, 1, metrics, time, metricGroup);
        pool.allocate(1, maxBlockTimeMs);
        assertThrows(BufferExhaustedException.class, () -> pool.allocate(2, maxBlockTimeMs));
    }
Test if BufferExhausted exception is thrown when there is not enough memory to allocate and the elapsed
time is greater than the max specified block time.
clients/src/test/java/org/apache/kafka/clients/producer/internals/BufferPoolTest.java