@Timeout(90)
    @ParameterizedTest(name = TEST_NAME_WITH_CONSUMER_RACK)
    @ValueSource(booleans = {false, true})
    public void testAssignmentAndGroupWithNonEqualSubscriptionNotTimeout(boolean hasConsumerRack) {
        initializeRacks(hasConsumerRack ? RackConfig.BROKER_AND_CONSUMER_RACK : RackConfig.NO_CONSUMER_RACK);
        int topicCount = hasConsumerRack ? 50 : 100;
        int partitionCount = 2_00;
        int consumerCount = 5_00;

        List<String> topics = new ArrayList<>();
        Map<String, List<PartitionInfo>> partitionsPerTopic = new HashMap<>();
        for (int i = 0; i < topicCount; i++) {
            String topicName = getTopicName(i, topicCount);
            topics.add(topicName);
            partitionsPerTopic.put(topicName, partitionInfos(topicName, partitionCount));
        }
        for (int i = 0; i < consumerCount; i++) {
            if (i % 4 == 0) {
                subscriptions.put(getConsumerName(i, consumerCount),
                        subscription(topics.subList(0, topicCount / 2), i));
            } else {
                subscriptions.put(getConsumerName(i, consumerCount),
                        subscription(topics.subList(topicCount / 2, topicCount), i));
            }
        }

        Map<String, List<TopicPartition>> assignment = assignor.assignPartitions(partitionsPerTopic, subscriptions);

        for (int i = 1; i < consumerCount; i++) {
            String consumer = getConsumerName(i, consumerCount);
            if (i % 4 == 0) {
                subscriptions.put(
                        consumer,
                        buildSubscriptionV2Above(topics.subList(0, topicCount / 2),
                        assignment.get(consumer), generationId, i)
                );
            } else {
                subscriptions.put(
                        consumer,
                        buildSubscriptionV2Above(topics.subList(topicCount / 2, topicCount),
                        assignment.get(consumer), generationId, i)
                );
            }
        }

        assignor.assignPartitions(partitionsPerTopic, subscriptions);
    }
This unit test performs sticky assignment for a scenario that round robin assignor handles poorly.
Topics (partitions per topic): topic1 (2), topic2 (1), topic3 (2), topic4 (1), topic5 (2)
Subscriptions:
 - consumer1: topic1, topic2, topic3, topic4, topic5
 - consumer2: topic1, topic3, topic5
 - consumer3: topic1, topic3, topic5
 - consumer4: topic1, topic2, topic3, topic4, topic5
Round Robin Assignment Result:
 - consumer1: topic1-0, topic3-0, topic5-0
 - consumer2: topic1-1, topic3-1, topic5-1
 - consumer3:
 - consumer4: topic2-0, topic4-0
Sticky Assignment Result:
 - consumer1: topic2-0, topic3-0
 - consumer2: topic1-0, topic3-1
 - consumer3: topic1-1, topic5-0
 - consumer4: topic4-0, topic5-1
clients/src/test/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignorTest.java