void () { Module module = createModule("module"); VirtualFile root = createChildDirectory(getOrCreateProjectBaseDir(), "module"); PsiTestUtil.addContentRoot(module, root); PsiDirectory directory = PsiManager.getInstance(myProject).findDirectory(root); MapDataContext context = new MapDataContext(); context.put(LangDataKeys.MODULE_CONTEXT, module); context.put(CommonDataKeys.PSI_ELEMENT, directory); context.put(PsiElementRenameHandler.DEFAULT_NAME, "newName"); RenameHandler renameHandler = chooseHandler(context, RenameModuleAndDirectoryHandler.class); Assume.assumeNotNull( "Other languages might have their own implementation of a processor that renames a directory. " + "In this case, the test fails under ultimate.tests.main.", renameHandler ); renameHandler.invoke(myProject, PsiElement.EMPTY_ARRAY, context); assertEquals("newName", module.getName()); assertEquals("newName", directory.getName()); }