void (final String newName, final String relPath) { doTest(() -> { final VirtualFile file = myFixture.findFileInTempDir(relPath); assert file != null; myFixture.configureFromExistingVirtualFile(file); final PsiElement element = TargetElementUtil.findTargetElement(getEditor(), TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED | TargetElementUtil.ELEMENT_NAME_ACCEPTED); assert element != null; final PsiElement substitution = RenamePsiElementProcessor.forElement(element).substituteElementToRename(element, getEditor()); assert substitution != null; new RenameProcessor(getProject(), substitution, newName, true, true).run(); }); }