void () { configureByFile(BASE_PATH + "/" + getTestName(false) + ".java"); final PsiElement element = TargetElementUtil.findTargetElement(getEditor(), TargetElementUtil.getInstance().getAllAccepted()); assertNotNull(element); Editor editor = getEditor(); Project project = editor.getProject(); TemplateManagerImpl.setTemplateTesting(getTestRootDisposable()); new MemberInplaceRenameHandler().doRename(element, editor, DataManager.getInstance().getDataContext(editor.getComponent())); TemplateState state = TemplateManagerImpl.getTemplateState(editor); assert state != null; assertEquals(2, state.getSegmentsCount()); final TextRange range = state.getCurrentVariableRange(); assert range != null; final Editor finalEditor = editor; WriteCommandAction.writeCommandAction(project) .run(() -> finalEditor.getDocument().replaceString(range.getStartOffset(), range.getEndOffset(), "newDoSomething ")); state = TemplateManagerImpl.getTemplateState(editor); assert state != null; state.gotoEnd(false); checkResultByFile(BASE_PATH + getTestName(false) + "_after.java"); }