void () { Module module = createModule("module"); VirtualFile root = createChildDirectory(getOrCreateProjectBaseDir(), "module"); PsiTestUtil.addContentRoot(module, root); PsiDirectory psiDirectory = PsiManager.getInstance(myProject).findDirectory(root); MapDataContext context = new MapDataContext(); context.put(LangDataKeys.MODULE_CONTEXT, module); context.put(CommonDataKeys.PSI_ELEMENT, psiDirectory); RenameHandler renameHandler = chooseHandler(context, RenameModuleHandler.class); assertNotNull(renameHandler); rename(renameHandler, "module2", context); assertEquals("module2", module.getName()); assertEquals("module", psiDirectory.getName()); // directory remains unchanged }