private ProduceRequest createProduceRequest(short version) {
        if (version < 2) {
            MemoryRecords records = MemoryRecords.withRecords(Compression.NONE, new SimpleRecord("blah".getBytes()));
            ProduceRequestData data = new ProduceRequestData()
                    .setAcks((short) -1)
                    .setTimeoutMs(123)
                    .setTopicData(new ProduceRequestData.TopicProduceDataCollection(singletonList(
                            new ProduceRequestData.TopicProduceData()
                                    .setName("topic1")
                                    .setPartitionData(singletonList(new ProduceRequestData.PartitionProduceData()
                                            .setIndex(1)
                                            .setRecords(records)))).iterator()));
            return new ProduceRequest.Builder(version, version, data).build(version);
        }
        byte magic = version == 2 ? RecordBatch.MAGIC_VALUE_V1 : RecordBatch.MAGIC_VALUE_V2;
        MemoryRecords records = MemoryRecords.withRecords(magic, Compression.NONE, new SimpleRecord("woot".getBytes()));
        return ProduceRequest.forMagic(magic,
                new ProduceRequestData()
                        .setTopicData(new ProduceRequestData.TopicProduceDataCollection(singletonList(
                                new ProduceRequestData.TopicProduceData()
                                        .setName("test")
                                        .setPartitionData(singletonList(new ProduceRequestData.PartitionProduceData()
                                                .setIndex(0)
                                                .setRecords(records)))).iterator()))
                        .setAcks((short) 1)
                        .setTimeoutMs(5000)
                        .setTransactionalId(version >= 3 ? "transactionalId" : null))
                .build(version);
    }
Check that all error codes in the response get included in {@link AbstractResponse#errorCounts()}.
clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java