@Override
    public synchronized Set<TopicPartition> assignment() {
        return this.subscriptions.assignedPartitions();
    }
A mock of the {@link Consumer} interface you can use for testing code that uses Kafka. This class is <i> not
threadsafe </i>. However, you can use the {@link #schedulePollTask(Runnable)} method to write multithreaded tests
where a driver thread waits for {@link #poll(Duration)} to be called by a background thread and then can safely perform
operations during a callback.
clients/src/main/java/org/apache/kafka/clients/consumer/MockConsumer.java