void (VirtualFile module1Content, boolean addSource, String junitLibName) { Module module = createEmptyModule(); if (addSource) { PsiTestUtil.addSourceRoot(module, module1Content, true); } else { PsiTestUtil.addContentRoot(module, module1Content); } IntelliJProjectConfiguration.LibraryRoots junit4Library = IntelliJProjectConfiguration.getProjectLibrary(junitLibName); ModuleRootModificationUtil.addModuleLibrary(module, junitLibName, junit4Library.getClassesUrls(), junit4Library.getSourcesUrls()); ModuleRootModificationUtil.setModuleSdk(module, ModuleRootManager.getInstance(myModule).getSdk()); GlobalSearchScope scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module); if ("JUnit4".equals(junitLibName)) { assertNotNull(JavaPsiFacade.getInstance(getProject()).findClass(JUnitUtil.TEST_CASE_CLASS, scope)); } Module missingModule = createTempModule(); addDependency(module, missingModule); ModuleManager.getInstance(myProject).disposeModule(missingModule); }