@Override
    public Map<Errors, Integer> errorCounts() {
        Map<Errors, Integer> errorCounts = new HashMap<>();
        data.results().forEach(topicResult ->
            topicResult.partitions().forEach(partitionResult ->
                updateErrorCounts(errorCounts, Errors.forCode(partitionResult.errorCode()))));
        return errorCounts;
    }
@Test
    public void testErrorCounts() {
        AlterReplicaLogDirsResponseData data = new AlterReplicaLogDirsResponseData()
                .setResults(asList(
                        new AlterReplicaLogDirTopicResult()
                                .setTopicName("t0")
                                .setPartitions(asList(
                                        new AlterReplicaLogDirPartitionResult()
                                                .setPartitionIndex(0)
                                                .setErrorCode(Errors.LOG_DIR_NOT_FOUND.code()),
                                        new AlterReplicaLogDirPartitionResult()
                                                .setPartitionIndex(1)
                                                .setErrorCode(Errors.NONE.code()))),
                        new AlterReplicaLogDirTopicResult()
                                .setTopicName("t1")
                                .setPartitions(Collections.singletonList(
                                        new AlterReplicaLogDirPartitionResult()
                                                .setPartitionIndex(0)
                                                .setErrorCode(Errors.LOG_DIR_NOT_FOUND.code())))));
        Map<Errors, Integer> counts = new AlterReplicaLogDirsResponse(data).errorCounts();
        assertEquals(2, counts.size());
        assertEquals(Integer.valueOf(2), counts.get(Errors.LOG_DIR_NOT_FOUND));
        assertEquals(Integer.valueOf(1), counts.get(Errors.NONE));

    }