private AddPartitionsToTxnRequest createAddPartitionsToTxnRequest(short version) {
        if (version < 4) {
            return AddPartitionsToTxnRequest.Builder.forClient("tid", 21L, (short) 42,
                    singletonList(new TopicPartition("topic", 73))).build(version);
        } else {
            AddPartitionsToTxnTransactionCollection transactions = new AddPartitionsToTxnTransactionCollection(
                singletonList(new AddPartitionsToTxnTransaction()
                    .setTransactionalId("tid")
                    .setProducerId(21L)
                    .setProducerEpoch((short) 42)
                    .setVerifyOnly(false)
                    .setTopics(new AddPartitionsToTxnTopicCollection(
                        singletonList(new AddPartitionsToTxnTopic()
                            .setName("topic")
                            .setPartitions(Collections.singletonList(73))).iterator())))
                    .iterator());
            return AddPartitionsToTxnRequest.Builder.forBroker(transactions).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