void () { Ref<DirectorySpec> classesDirSpec = new Ref<>(); Ref<DirectorySpec> classesExcludedDirSpec = new Ref<>(); Ref<DirectorySpec> sourcesDirSpec = new Ref<>(); Ref<DirectorySpec> sourcesExcludedDirSpec = new Ref<>(); VirtualFile sdkRoot = tempDirectory.newVirtualDirectory("sdkRoot"); ProjectStructureDslKt.buildDirectoryContent(sdkRoot, contentBuilder -> { contentBuilder.dir("sdk", sdkBuilder -> { classesDirSpec.set(sdkBuilder.dir("classes", builder -> { classesExcludedDirSpec.set(builder.dir("excludedInClasses", ignored -> Unit.INSTANCE)); return Unit.INSTANCE; })); sourcesDirSpec.set(sdkBuilder.dir("sources", builder -> { sourcesExcludedDirSpec.set(builder.dir("excludedInSources", ignored -> Unit.INSTANCE)); return Unit.INSTANCE; })); return Unit.INSTANCE; }); return Unit.INSTANCE; }); VirtualFile classesDir = ProjectStructureDslKt.resolveVirtualFile(classesDirSpec.get()); VirtualFile classesExcludedDir = ProjectStructureDslKt.resolveVirtualFile(classesExcludedDirSpec.get()); VirtualFile sourcesDir = ProjectStructureDslKt.resolveVirtualFile(sourcesDirSpec.get()); VirtualFile sourcesExcludedDir = ProjectStructureDslKt.resolveVirtualFile(sourcesExcludedDirSpec.get()); Sdk sdk = projectModelRule.addSdk("sdkName", sdkModificator -> { sdkModificator.addRoot(classesDir, OrderRootType.CLASSES); sdkModificator.addRoot(sourcesDir, OrderRootType.SOURCES); return Unit.INSTANCE; }); Module module = projectModelRule.createModule("module"); ModuleRootModificationUtil.setModuleSdk(module, sdk); assertNothingToRescan(); updateExcludedFromSdkRoots(roots -> { roots.add(classesExcludedDir); roots.add(sourcesExcludedDir); }); assertNothingToRescanAndFinishIndexing(); updateExcludedFromSdkRoots(urls -> urls.clear()); assertRescanningSdkContent(UNSURE, classesExcludedDir, sourcesExcludedDir); updateExcludedFromSdkRoots(roots -> { roots.add(sourcesExcludedDir); }); assertRescanningSdkContent(YES, classesExcludedDir); updateExcludedFromSdkRoots(roots -> roots.clear()); assertRescanningSdkContent(YES, sourcesExcludedDir); }