Description
The ConsumerRecords returned from MockConsumer.poll can return false for isEmpty while not containing any records. This behavior is because MockConsumer.poll eagerly adds entries to the returned Map<TopicPartition, List<ConsumerRecord>>, based on which partitions have been added. If no records are returned for a partition, e.g. because the position was too far ahead, the entry for that partition will still be there.
The MockConsumer should lazily add entries to the map as they are needed, since it is more in line with how the real consumer behaves.
Attachments
Issue Links
- links to