private AlterPartitionRequest createAlterPartitionRequest(short version) {
        AlterPartitionRequestData.PartitionData partitionData = new AlterPartitionRequestData.PartitionData()
            .setPartitionIndex(1)
            .setPartitionEpoch(2)
            .setLeaderEpoch(3)
            .setNewIsrWithEpochs(AlterPartitionRequest.newIsrToSimpleNewIsrWithBrokerEpochs(asList(1, 2)));

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

        AlterPartitionRequestData data = new AlterPartitionRequestData()
            .setBrokerEpoch(123L)
            .setBrokerId(1)
            .setTopics(singletonList(new AlterPartitionRequestData.TopicData()
                .setTopicName("topic1")
                .setTopicId(Uuid.randomUuid())
                .setPartitions(singletonList(partitionData))));
        return new AlterPartitionRequest.Builder(data, version >= 1).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