void (String newName) { PsiElement element = TargetElementUtil.findTargetElement(myFixture.getEditor(), TargetElementUtil .ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED); RenameRefactoring refactoring = RefactoringFactory.getInstance(getProject()).createRename(element, newName, false, false); refactoring.respectAllAutomaticRenames(); refactoring.run(); }