Class MockConsumer<K,​V>

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, Consumer<K,​V>

    public class MockConsumer<K,​V>
    extends java.lang.Object
    implements Consumer<K,​V>

    This class is not supported.

    A mock of the Consumer interface you can use for testing code that uses Kafka. This class is not threadsafe . However, you can use the schedulePollTask(Runnable) method to write multithreaded tests where a driver thread waits for poll(Duration) to be called by a background thread and then can safely perform operations during a callback.