void () { assertNull(getJavaFacade().findClass("pack.MyClass", GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(myModule))); final Library.ModifiableModel model = myLib.getModifiableModel(); ApplicationManager.getApplication().runWriteAction(() -> { model.addRoot(myRoot, OrderRootType.CLASSES); model.commit(); }); assertNotNull(getJavaFacade().findClass("pack.MyClass", GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(myModule))); }