@Test
    public void testErrorsInOnPreviousCloseCallbacksAreNotSwallowed() {
        IdempotentCloser ic = new IdempotentCloser();

        // Verify initial invariants.
        assertFalse(ic.isClosed());

        // Perform the initial close. No errors here.
        ic.close(CALLBACK_NO_OP);
        assertTrue(ic.isClosed());

        // Perform the subsequent close and verify that the exception is bubbled up to the user.
        assertThrows(RuntimeException.class, () -> ic.close(CALLBACK_NO_OP, CALLBACK_WITH_RUNTIME_EXCEPTION));
        assertTrue(ic.isClosed());
    }
Tests that if the invoked onSubsequentClose callback throws an exception, that it is thrown from
{@link IdempotentCloser#close(Runnable, Runnable)} so the user can handle it.
clients/src/test/java/org/apache/kafka/common/internals/IdempotentCloserTest.java