void (List<Module> modules) { assertEquals(6, modules.size()); ProjectFileIndex index = ProjectFileIndex.getInstance(myProject); VirtualFile m3JavaDir = VfsUtil.findFileByIoFile(new File(getProjectPath(), "m3/src/main/java"), true); assertNotNull(m3JavaDir); // Should be: m1 -> m3, m2 -> m3, m3 -> source, and m4 -> m3 List<OrderEntry> orderEntries = index.getOrderEntriesForFile(m3JavaDir); assertEquals(4, orderEntries.size()); List<Module> ownerModules = orderEntriesToOwnerModules(orderEntries); List<Module> depModules = orderEntriesToDepModules(orderEntries); assertOrderedElementsAreEqual(ownerModules, Arrays.asList(modules.get(0), modules.get(1), modules.get(2), modules.get(3))); assertOrderedElementsAreEqual(depModules, Arrays.asList(modules.get(2), modules.get(2), null, modules.get(2))); // m3 -> source OrderEntry m3E2 = orderEntries.get(2); assertInstanceOf(m3E2, ModuleSourceOrderEntry.class); VirtualFile m6javaDir = VfsUtil.findFileByIoFile(new File(getProjectPath(), "m6/src/main/java"), true); assertNotNull(m6javaDir); // Should be m1 -> m6, m2 -> m6, m5 -> m6, m6 -> source List<OrderEntry> m6OrderEntries = index.getOrderEntriesForFile(m6javaDir); assertEquals(4, m6OrderEntries.size()); List<Module> m6OwnerModules = orderEntriesToOwnerModules(m6OrderEntries); List<Module> m6DepModules = orderEntriesToDepModules(m6OrderEntries); assertOrderedElementsAreEqual(m6OwnerModules, Arrays.asList(modules.get(0), modules.get(1), modules.get(4), modules.get(5))); assertOrderedElementsAreEqual(m6DepModules, Arrays.asList(modules.get(5), modules.get(5), modules.get(5), null)); // m6 -> source OrderEntry m6E3 = m6OrderEntries.get(3); assertInstanceOf(m6E3, ModuleSourceOrderEntry.class); VirtualFile jmockDir = VfsUtil.findFileByIoFile(new File(getRepositoryPath(), "jmock/jmock/1.0/jmock-1.0.jar"), true); assertNotNull(jmockDir); VirtualFile jmockJar = JarFileSystem.getInstance().getJarRootForLocalFile(jmockDir); assertNotNull(jmockJar); // m2 -> jmock, m3 -> jmock List<OrderEntry> jmockOrderEntries = index.getOrderEntriesForFile(jmockJar); assertEquals(2, jmockOrderEntries.size()); OrderEntry jmockE0 = jmockOrderEntries.get(0); assertEquals(modules.get(1), jmockE0.getOwnerModule()); assertInstanceOf(jmockE0, LibraryOrderEntry.class); OrderEntry jmockE1 = jmockOrderEntries.get(1); assertEquals(modules.get(2), jmockE1.getOwnerModule()); assertInstanceOf(jmockE1, LibraryOrderEntry.class); }