void () { final String filename = getTestName(true) + ".xml"; VirtualFile vfile = VirtualFileManager.getInstance().findFileByUrl("file://" + getTestDataPath() + filename); String text = FileDocumentManager.getInstance().getDocument(vfile).getText(); final int off = text.indexOf("<ren>"); text = text.replace("<ren>", ""); configureFromFileText(filename, text); assertNotNull(getFile()); PsiElement element = TargetElementUtil.getInstance().findTargetElement( getEditor(), TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED | TargetElementUtil.ELEMENT_NAME_ACCEPTED, off); assertNotNull(element); assertTrue(element instanceof PsiNamedElement); final RenameRefactoring rename = RefactoringFactory.getInstance(getProject()).createRename(element, ((PsiNamedElement)element).getName() + "-after"); rename.setSearchInComments(false); rename.setSearchInNonJavaFiles(false); rename.run(); checkResultByFile(filename + "-after"); }