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

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

        // Upon close, our onClose callback will throw an error. First ensure that it is thrown at the user.
        assertThrows(RuntimeException.class, () -> ic.close(CALLBACK_WITH_RUNTIME_EXCEPTION));

        // Make sure the IdempotentCloser is still closed, though.
        assertTrue(ic.isClosed());
    }
Tests that if the invoked onClose callback throws an exception, that:

<ol>
    <li>The exception does not prevent the {@link IdempotentCloser} from being updated to the closed state</li>
    <li>The exception is bubbled up to the user</li>
</ol>
clients/src/test/java/org/apache/kafka/common/internals/IdempotentCloserTest.java