@Test
public void testMultipleConsumersMixedTopics() {

    String topic1 = "topic1";
    String topic2 = "topic2";
    String consumer1 = "consumer1";
    String consumer2 = "consumer2";
    String consumer3 = "consumer3";
    Map<String, Integer> partitionsPerTopic = new HashMap<>();
    partitionsPerTopic.put(topic1, 3);
    partitionsPerTopic.put(topic2, 2);
    Map<String, List<String>> consumers = new HashMap<>();
    consumers.put(consumer1, Arrays.asList(topic1));
    consumers.put(consumer2, Arrays.asList(topic1, topic2));
    consumers.put(consumer3, Arrays.asList(topic1));
    Map<String, List<TopicPartition>> assignment = assignor.assign(partitionsPerTopic, consumers);
    assertAssignment(Arrays.asList(
            new TopicPartition(topic1, 0)), assignment.get(consumer1));
    assertAssignment(Arrays.asList(
            new TopicPartition(topic1, 1),
            new TopicPartition(topic2, 0),
            new TopicPartition(topic2, 1)), assignment.get(consumer2));
    assertAssignment(Arrays.asList(
            new TopicPartition(topic1, 2)), assignment.get(consumer3));
}