private void verifyUnsubscribeEvent(SubscriptionState subscriptions) {
        // Check that an unsubscribe event was generated, and that the consumer waited for it to
        // complete processing background events.
        verify(applicationEventHandler).add(any(UnsubscribeEvent.class));
        verify(consumer).processBackgroundEvents(any(), any());

        // The consumer should not clear the assignment in the app thread. The unsubscribe
        // event is the one responsible for updating the assignment in the background when it
        // completes.
        verify(subscriptions, never()).assignFromSubscribed(any());
    }
Tests that calling {@link Thread#interrupt()} before {@link KafkaConsumer#poll(Duration)}
causes {@link InterruptException} to be thrown.
clients/src/test/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumerTest.java