private void pollAndValidateMaxPollRecordsNotExceeded(int maxPollRecords) {
        consumerClient.poll(time.timer(0));
        Map<TopicPartition, List<ConsumerRecord<byte[], byte[]>>> recordsByPartition = fetchRecords();
        int fetchedRecords = 0;
        for (List<ConsumerRecord<byte[], byte[]>> recordsToTest : recordsByPartition.values()) {
            fetchedRecords += recordsToTest.size();
        }
        assertEquals(maxPollRecords, fetchedRecords);
    }
KAFKA-15836:
Test that max.poll.records is honoured when consuming from multiple topic-partitions and the
fetched records are not aligned on max.poll.records boundaries.

tp0 has records 1,2,3; tp1 has records 6,7,8
max.poll.records is 2

poll 1 should return 1,2
poll 2 should return 3,6
poll 3 should return 7,8

Or it can be 6,7; then 8,1; then 2,3 because the order of topic-partitions returned is non-deterministic.
clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetcherTest.java