private StopReplicaRequest createStopReplicaRequest(short version, boolean deletePartitions) {
        List<StopReplicaTopicState> topicStates = new ArrayList<>();
        StopReplicaTopicState topic1 = new StopReplicaTopicState()
            .setTopicName("topic1")
            .setPartitionStates(singletonList(new StopReplicaPartitionState()
                .setPartitionIndex(0)
                .setLeaderEpoch(1)
                .setDeletePartition(deletePartitions)));
        topicStates.add(topic1);
        StopReplicaTopicState topic2 = new StopReplicaTopicState()
            .setTopicName("topic2")
            .setPartitionStates(singletonList(new StopReplicaPartitionState()
                .setPartitionIndex(1)
                .setLeaderEpoch(2)
                .setDeletePartition(deletePartitions)));
        topicStates.add(topic2);

        return new StopReplicaRequest.Builder(version, 0, 1, 0,
            deletePartitions, topicStates).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