Updater implements CacheUpdater { protected VirtualFile[] selectParentlessRootsAndSort(List<VirtualFile> roots) { List<VirtualFile> result = new ArrayList<VirtualFile>(); for (VirtualFile r : roots) { if (parentIsNotUnderContentRoot(r)) result.add(r); } ContainerUtil.removeDuplicates(result); sortRoots(result); return result.toArray(new VirtualFile[result.size()]); } Updater(LocalVcs vcs, IdeaGateway gw); VirtualFile[] queryNeededFiles(); void processFile(FileContent c); void updatingDone(); void canceled();  }
@Test public void testSelectingOnlyUniqueRoots() { VirtualFile root = new TestVirtualFile("root"); Updater u = new Updater(vcs, gw); VirtualFile[] result = u.selectParentlessRootsAndSort(list(root, root)); assertArrayEquals(array(root), result); }