public static Builder forCurrentMagic(ProduceRequestData data) {
        return forMagic(RecordBatch.CURRENT_MAGIC_VALUE, data);
    }
@Test
    public void testV6AndBelowCannotUseZStdCompression() {
        ByteBuffer buffer = ByteBuffer.allocate(256);
        MemoryRecordsBuilder builder = MemoryRecords.builder(buffer, RecordBatch.MAGIC_VALUE_V2, Compression.zstd().build(),
            TimestampType.CREATE_TIME, 0L);
        builder.append(10L, null, "a".getBytes());

        ProduceRequestData produceData = new ProduceRequestData()
                .setTopicData(new ProduceRequestData.TopicProduceDataCollection(Collections.singletonList(
                    new ProduceRequestData.TopicProduceData()
                        .setName("test")
                        .setPartitionData(Collections.singletonList(new ProduceRequestData.PartitionProduceData()
                            .setIndex(0)
                            .setRecords(builder.build()))))
                    .iterator()))
                .setAcks((short) 1)
                .setTimeoutMs(1000);
        // Can't create ProduceRequest instance with version within [3, 7)
        for (short version = 3; version < 7; version++) {

            ProduceRequest.Builder requestBuilder = new ProduceRequest.Builder(version, version, produceData);
            assertThrowsForAllVersions(requestBuilder, UnsupportedCompressionTypeException.class);
        }

        // Works fine with current version (>= 7)
        ProduceRequest.forCurrentMagic(produceData);
    }