void () { Ref<DirectorySpec> classesDirSpec = new Ref<>(); Ref<DirectorySpec> sourcesDirSpec = new Ref<>(); VirtualFile sdkRoot = tempDirectory.newVirtualDirectory("sdkRoot"); ProjectStructureDslKt.buildDirectoryContent(sdkRoot, contentBuilder -> { contentBuilder.dir("sdk", sdkBuilder -> { classesDirSpec.set(sdkBuilder.dir("classes", builder -> Unit.INSTANCE)); sourcesDirSpec.set(sdkBuilder.dir("sources", builder -> Unit.INSTANCE)); return Unit.INSTANCE; }); return Unit.INSTANCE; }); VirtualFile classesDir = ProjectStructureDslKt.resolveVirtualFile(classesDirSpec.get()); VirtualFile sourcesDir = ProjectStructureDslKt.resolveVirtualFile(sourcesDirSpec.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(); updateExcludedRoots(urls -> { urls.add(classesDir.getUrl()); urls.add(sourcesDir.getUrl()); }); assertNothingToRescanAndFinishIndexing(); updateExcludedRoots(urls -> urls.clear()); assertRescanningSdkContent(UNSURE, classesDir, sourcesDir); updateExcludedRoots(urls -> { urls.add(sourcesDir.getUrl()); }); assertRescanningSdkContent(YES, classesDir); updateExcludedRoots(urls -> urls.clear()); assertRescanningSdkContent(YES, sourcesDir); }