void (Consumer<Pair<VirtualFile, VirtualFile>> libraryCreator) { Ref<DirectorySpec> classesDirSpec = new Ref<>(); Ref<DirectorySpec> sourcesDirSpec = new Ref<>(); VirtualFile sdkRoot = tempDirectory.newVirtualDirectory("sdkRoot"); ProjectStructureDslKt.buildDirectoryContent(sdkRoot, contentBuilder -> { contentBuilder.dir("library", 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()); libraryCreator.accept(new Pair<>(classesDir, sourcesDir)); assertNothingToRescan(); updateExcludedRoots(urls -> { urls.add(classesDir.getUrl()); urls.add(sourcesDir.getUrl()); }); assertNothingToRescanAndFinishIndexing(); updateExcludedRoots(urls -> urls.clear()); assertRescanningLibraryContent(UNSURE, Collections.singletonList(classesDir), Collections.singletonList(sourcesDir)); updateExcludedRoots(urls -> { urls.add(sourcesDir.getUrl()); }); assertRescanningLibraryContent(YES, Collections.singletonList(classesDir), Collections.emptyList()); updateExcludedRoots(urls -> urls.clear()); assertRescanningLibraryContent(YES, Collections.emptyList(), Collections.singletonList(sourcesDir)); }