@Override
        public void onCommit(Map<TopicPartition, OffsetAndMetadata> offsets) {
            onCommitCount++;
            if (throwExceptionOnCommit)
                throw new KafkaException("Injected exception in FilterConsumerInterceptor.onCommit.");
        }
Test consumer interceptor that filters records in onConsume() intercept
clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerInterceptorsTest.java