Module (String moduleName, @Nullable VirtualFile sourceRoot, @Nullable VirtualFile testRoot, @Nullable VirtualFile resourceRoot) { return WriteAction.computeAndWait(() -> { Module module = createModule(moduleName); if (sourceRoot != null) { PsiTestUtil.addSourceContentToRoots(module, sourceRoot, false); } if (testRoot != null) { PsiTestUtil.addSourceContentToRoots(module, testRoot, true); } if (resourceRoot != null) { PsiTestUtil.addResourceContentToRoots(module, resourceRoot, false); } ModuleRootModificationUtil.setModuleSdk(module, getTestProjectJdk()); return module; }); }