public Map<TopicPartition, String> partitionDirs() {
        Map<TopicPartition, String> result = new HashMap<>();
        data.dirs().forEach(alterDir ->
            alterDir.topics().forEach(topic ->
                topic.partitions().forEach(partition ->
                    result.put(new TopicPartition(topic.name(), partition), alterDir.path())))
        );
        return result;
    }
@Test
    public void testPartitionDir() {
        AlterReplicaLogDirsRequestData data = new AlterReplicaLogDirsRequestData()
                .setDirs(new AlterReplicaLogDirCollection(
                        asList(new AlterReplicaLogDir()
                                .setPath("/data0")
                                .setTopics(new AlterReplicaLogDirTopicCollection(
                                        asList(new AlterReplicaLogDirTopic()
                                                .setName("topic")
                                                .setPartitions(asList(0, 1)),
                                               new AlterReplicaLogDirTopic()
                                                .setName("topic2")
                                                .setPartitions(singletonList(7))).iterator())),
                                new AlterReplicaLogDir()
                                        .setPath("/data1")
                                        .setTopics(new AlterReplicaLogDirTopicCollection(
                                                singletonList(new AlterReplicaLogDirTopic()
                                                        .setName("topic3")
                                                        .setPartitions(singletonList(12))).iterator()))).iterator()));
        AlterReplicaLogDirsRequest request = new AlterReplicaLogDirsRequest.Builder(data).build();
        Map<TopicPartition, String> expect = new HashMap<>();
        expect.put(new TopicPartition("topic", 0), "/data0");
        expect.put(new TopicPartition("topic", 1), "/data0");
        expect.put(new TopicPartition("topic2", 7), "/data0");
        expect.put(new TopicPartition("topic3", 12), "/data1");
        assertEquals(expect, request.partitionDirs());
    }