### Question:
ExplorerServiceHelper { List<FolderItem> getPathSegments(final Path path) { org.uberfire.java.nio.file.Path nioSegmentPath = Paths.convert(path); final int segmentCount = nioSegmentPath.getNameCount(); if (segmentCount < 1) { return new ArrayList<>(); } final FolderItem[] segments = new FolderItem[segmentCount]; for (int idx = segmentCount; idx > 0; idx--) { nioSegmentPath = nioSegmentPath.getParent(); segments[idx - 1] = toFolderItem(nioSegmentPath); } return Arrays.asList(segments); } ExplorerServiceHelper(); @Inject  ExplorerServiceHelper(final KieModuleService moduleService,
                                 final FolderListingResolver folderListingResolver,
                                 @Named("ioStrategy") final IOService ioService,
                                 @Named("configIO") final IOService ioServiceConfig,
                                 final VFSLockServiceImpl lockService,
                                 final MetadataService metadataService,
                                 final UserServicesImpl userServices,
                                 final DeleteService deleteService,
                                 final RenameService renameService,
                                 final CopyService copyService,
                                 @Managed final ExecutorService executorService); FolderItem toFolderItem(final org.guvnor.common.services.project.model.Package pkg); FolderItem toFolderItem(final org.uberfire.java.nio.file.Path path); List<FolderItem> getPackageSegments(final Package _pkg); FolderListing getFolderListing(final FolderItem selectedItem,
                                          final Module selectedModule,
                                          final Package selectedPackage,
                                          final ActiveOptions options); FolderListing getFolderListing(final Package pkg,
                                          final ActiveOptions options); FolderListing getFolderListing(final FolderItem item,
                                          final ActiveOptions options); FolderListing getFolderListing(final Path path,
                                          final ActiveOptions options
    ); boolean hasAssets(final Package pkg); List<FolderItem> getItems(final Package pkg,
                                     final ActiveOptions options); void store(final WorkspaceProject project,
                      final Module selectedModule,
                      final FolderListing folderListing,
                      final Package selectedPackage,
                      final ActiveOptions options); void store(final org.uberfire.java.nio.file.Path userNav,
                      final org.uberfire.java.nio.file.Path lastUserNav,
                      final WorkspaceProject project,
                      final Module module,
                      final Package pkg,
                      final FolderItem item,
                      final ActiveOptions options); UserExplorerData loadUserContent(final org.uberfire.java.nio.file.Path path); UserExplorerData loadUserContent(); UserExplorerLastData getLastContent(); UserExplorerLastData getLastContent(final org.uberfire.java.nio.file.Path path); List<FolderItemOperation> getRestrictedOperations(final Path path);  }### Answer:
@Test public void getPathSegmentsTest() { doAnswer(invocationOnMock -> { final Path p = Paths.convert((org.uberfire.java.nio.file.Path) invocationOnMock.getArguments()[0]); return new FolderItem(p, p.getFileName(), FolderItemType.FOLDER); }).when(helper).toFolderItem(any(org.uberfire.java.nio.file.Path.class)); Path path = PathFactory.newPath("myproject", "default: final List<FolderItem> pathSegments = helper.getPathSegments(path); assertEquals(5, pathSegments.size()); assertEquals("/", pathSegments.get(0).getFileName()); assertEquals("src", pathSegments.get(1).getFileName()); assertEquals("main", pathSegments.get(2).getFileName()); assertEquals("java", pathSegments.get(3).getFileName()); assertEquals("org", pathSegments.get(4).getFileName()); }