private AssignReplicasToDirsResponse createAssignReplicasToDirsResponse() {
        AssignReplicasToDirsResponseData data = new AssignReplicasToDirsResponseData()
                .setErrorCode(Errors.NONE.code())
                .setThrottleTimeMs(123)
                .setDirectories(Arrays.asList(
                        new AssignReplicasToDirsResponseData.DirectoryData()
                                .setId(Uuid.randomUuid())
                                .setTopics(singletonList(
                                        new AssignReplicasToDirsResponseData.TopicData()
                                                .setTopicId(Uuid.fromString("sKhZV8LnTA275KvByB9bVg"))
                                                .setPartitions(singletonList(
                                                        new AssignReplicasToDirsResponseData.PartitionData()
                                                                .setPartitionIndex(8)
                                                                .setErrorCode(Errors.NONE.code())
                                                ))
                                )),
                        new AssignReplicasToDirsResponseData.DirectoryData()
                                .setId(Uuid.randomUuid())
                                .setTopics(singletonList(
                                        new AssignReplicasToDirsResponseData.TopicData()
                                                .setTopicId(Uuid.fromString("ORLP5NEzRo64SvKq1hIVQg"))
                                                .setPartitions(asList(
                                                        new AssignReplicasToDirsResponseData.PartitionData()
                                                                .setPartitionIndex(2)
                                                                .setErrorCode(Errors.UNKNOWN_TOPIC_OR_PARTITION.code()),
                                                        new AssignReplicasToDirsResponseData.PartitionData()
                                                                .setPartitionIndex(8)
                                                                .setErrorCode(Errors.NONE.code())
                                                ))
                                ))
                ));
        return new AssignReplicasToDirsResponse(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