@ParameterizedTest
    @MethodSource("testFetchWithOtherErrorsSource")
    public void testFetchWithOtherErrors(final Errors error) {
        buildDependencies();
        subscribeAndAssign(topicAPartition0);

        ShareCompletedFetch completedFetch = completedFetchBuilder
                .error(error)
                .build();
        fetchBuffer.add(completedFetch);
        assertThrows(IllegalStateException.class, () -> fetchCollector.collect(fetchBuffer));
    }
This tests the {@link ShareFetchCollector} functionality.
clients/src/test/java/org/apache/kafka/clients/consumer/internals/ShareFetchCollectorTest.java