void () { VirtualFile mainModuleRoot = ModuleRootManager.getInstance(myModule).getContentRoots()[0]; PsiTestUtil.addExcludedRoot(myModule, mainModuleRoot.findFileByRelativePath("src/com/package1/p2")); Module module = createModule("nested_module"); ModifiableModuleModel moduleModel = ModuleManager.getInstance(myProject).getModifiableModel(); moduleModel.setModuleGroupPath(module, new String[]{"modules"}); WriteAction.runAndWait(() -> moduleModel.commit()); PsiTestUtil.addContentRoot(module, mainModuleRoot.findFileByRelativePath("src/com/package1/p2/p3")); myStructure.setShowLibraryContents(false); myStructure.hideExcludedFiles(); assertStructureEqual(""" Project noDuplicateModules src com package1 Test.java """); }