void () { VirtualFile a = createFile("root/src/a/A.java", "package a; class A{}"); createFile("root/src/b/B.java", "package b; class B{}"); Module m = addModule("m", null); VirtualFile srcRoot = a.getParent().getParent(); PsiTestUtil.addContentRoot(m, srcRoot.getParent()); PsiTestUtil.addSourceRoot(m, srcRoot); make(m); assertModulesUpToDate(); assertOutput(m, fs().dir("a").file("A.class").end().dir("b").file("B.class")); ModuleRootModificationUtil.updateModel(m, model -> ApplicationManager.getApplication().runReadAction(() -> { model.getContentEntries()[0].addExcludePattern("B.*"); })); make(m); assertOutput(m, fs().dir("a").file("A.class")); ModuleRootModificationUtil.updateModel(m, model -> ApplicationManager.getApplication().runReadAction(() -> { model.getContentEntries()[0].removeExcludePattern("B.*"); })); make(m); assertOutput(m, fs().dir("a").file("A.class").end().dir("b").file("B.class")); }