private static void assertGroupListing(
        ConsumerGroupCommand.ConsumerGroupService service,
        Set<GroupType> typeFilterSet,
        Set<ConsumerGroupState> stateFilterSet,
        Set<ConsumerGroupListing> expectedListing
    ) throws Exception {
        final AtomicReference<Set<ConsumerGroupListing>> foundListing = new AtomicReference<>();
        TestUtils.waitForCondition(() -> {
            foundListing.set(set(service.listConsumerGroupsWithFilters(set(typeFilterSet), set(stateFilterSet))));
            return Objects.equals(set(expectedListing), foundListing.get());
        }, () -> "Expected to show groups " + expectedListing + ", but found " + foundListing.get() + ".");
    }
Validates the consumer group listings returned against expected values using specified filters.

@param service           The service to list consumer groups.
@param typeFilterSet     Filters for group types, empty for no filter.
@param stateFilterSet    Filters for group states, empty for no filter.
@param expectedListing   Expected consumer group listings.
tools/src/test/java/org/apache/kafka/tools/consumer/group/ListConsumerGroupTest.java