private AlterPartitionResponse createAlterPartitionResponse(int version) {
        AlterPartitionResponseData.PartitionData partitionData = new AlterPartitionResponseData.PartitionData()
            .setPartitionEpoch(1)
            .setIsr(asList(0, 1, 2))
            .setErrorCode(Errors.NONE.code())
            .setLeaderEpoch(2)
            .setLeaderId(3);

        if (version >= 1) {
            // Use the none default value; 1 - RECOVERING
            partitionData.setLeaderRecoveryState((byte) 1);
        }

        AlterPartitionResponseData data = new AlterPartitionResponseData()
                .setErrorCode(Errors.NONE.code())
                .setThrottleTimeMs(123)
                .setTopics(singletonList(new AlterPartitionResponseData.TopicData()
                    .setTopicName("topic1")
                    .setTopicId(Uuid.randomUuid())
                    .setPartitions(singletonList(partitionData))));
        return new AlterPartitionResponse(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