void () { Path path = ProjectKt.getStateStore(getProject()).getProjectBasePath(); int count = 100; for (int i = 0; i < count; i++) { String name = "module" + i; Path dir = path.resolve(name); createModule(name, dir, path, getProject()); String inner = "inner" + i; createModule(inner, dir.resolve(inner), path, getProject()); } StoreUtil.saveSettings(myProject, false); String projectFilePath = myProject.getProjectFilePath(); String moduleName = myModule.getName(); PlatformTestUtil.forceCloseProjectWithoutSaving(myProject); myProject = PlatformTestUtil.loadAndOpenProject(Paths.get(projectFilePath), getTestRootDisposable()); Module[] modules = ModuleManager.getInstance(myProject).getModules(); assertThat(modules).hasSize(count * 2 + 1); for (Module module : modules) { if (moduleName.equals(module.getName())) { continue; } String root = ModuleRootManager.getInstance(module).getContentRootUrls()[0]; assertThat(PathUtil.getFileName(VfsUtilCore.urlToPath(root))).isEqualTo(module.getName()); } }