private static void verifyDownConvertedRecords(List<SimpleRecord> initialRecords,
                                                   List<Long> initialOffsets,
                                                   MemoryRecords downConvertedRecords,
                                                   CompressionType compressionType,
                                                   byte toMagic) {
        int i = 0;
        for (RecordBatch batch : downConvertedRecords.batches()) {
            assertTrue(batch.magic() <= toMagic, "Magic byte should be lower than or equal to " + toMagic);
            if (batch.magic() == RecordBatch.MAGIC_VALUE_V0)
                assertEquals(TimestampType.NO_TIMESTAMP_TYPE, batch.timestampType());
            else
                assertEquals(TimestampType.CREATE_TIME, batch.timestampType());
            assertEquals(compressionType, batch.compressionType(), "Compression type should not be affected by conversion");
            for (Record record : batch) {
                assertTrue(record.hasMagic(batch.magic()), "Inner record should have magic " + toMagic);
                assertEquals(initialOffsets.get(i).longValue(), record.offset(), "Offset should not change");
                assertEquals(utf8(initialRecords.get(i).key()), utf8(record.key()), "Key should not change");
                assertEquals(utf8(initialRecords.get(i).value()), utf8(record.value()), "Value should not change");
                assertFalse(record.hasTimestampType(TimestampType.LOG_APPEND_TIME));
                if (batch.magic() == RecordBatch.MAGIC_VALUE_V0) {
                    assertEquals(RecordBatch.NO_TIMESTAMP, record.timestamp());
                    assertFalse(record.hasTimestampType(TimestampType.CREATE_TIME));
                    assertTrue(record.hasTimestampType(TimestampType.NO_TIMESTAMP_TYPE));
                } else if (batch.magic() == RecordBatch.MAGIC_VALUE_V1) {
                    assertEquals(initialRecords.get(i).timestamp(), record.timestamp(), "Timestamp should not change");
                    assertTrue(record.hasTimestampType(TimestampType.CREATE_TIME));
                    assertFalse(record.hasTimestampType(TimestampType.NO_TIMESTAMP_TYPE));
                } else {
                    assertEquals(initialRecords.get(i).timestamp(), record.timestamp(), "Timestamp should not change");
                    assertFalse(record.hasTimestampType(TimestampType.CREATE_TIME));
                    assertFalse(record.hasTimestampType(TimestampType.NO_TIMESTAMP_TYPE));
                    assertArrayEquals(initialRecords.get(i).headers(), record.headers(), "Headers should not change");
                }
                i += 1;
            }
        }
        assertEquals(initialOffsets.size(), i);
    }
Test the lazy down-conversion path.

If `overflow` is true, the number of bytes we want to convert is much larger
than the number of bytes we get after conversion. This causes overflow message batch(es) to be appended towards the
end of the converted output.
clients/src/test/java/org/apache/kafka/common/record/LazyDownConversionRecordsTest.java