private AddPartitionsToTxnResponse createAddPartitionsToTxnResponse(short version) {
        String txnId = version < 4 ? AddPartitionsToTxnResponse.V3_AND_BELOW_TXN_ID : "tid";
        AddPartitionsToTxnResponseData.AddPartitionsToTxnResult result = AddPartitionsToTxnResponse.resultForTransaction(
                txnId, Collections.singletonMap(new TopicPartition("t", 0), Errors.NONE));
        AddPartitionsToTxnResponseData data = new AddPartitionsToTxnResponseData().setThrottleTimeMs(0);
        
        if (version < 4) {
            data.setResultsByTopicV3AndBelow(result.topicResults());
        } else {
            data.setResultsByTransaction(new AddPartitionsToTxnResponseData.AddPartitionsToTxnResultCollection(singletonList(result).iterator()));
        }
        return new AddPartitionsToTxnResponse(data);
    }
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