void () { configureByFile(BASE_PATH + "/" + getTestName(false) + ".java"); int originalCaretPosition = getEditor().getCaretModel().getOffset(); Inlay inlay = EditorTestUtil.addInlay(getEditor(), originalCaretPosition); VisualPosition inlayPosition = inlay.getVisualPosition(); // make sure caret is to the right of inlay initially getEditor().getCaretModel().moveToVisualPosition(new VisualPosition(inlayPosition.line, inlayPosition.column + 1)); final PsiElement element = TargetElementUtil.findTargetElement(getEditor(), TargetElementUtil.getInstance().getAllAccepted()); assertNotNull(element); TemplateManagerImpl.setTemplateTesting(getTestRootDisposable()); new MemberInplaceRenameHandler().doRename(element, getEditor(), DataManager.getInstance().getDataContext(getEditor().getComponent())); assertEquals(originalCaretPosition, getEditor().getCaretModel().getOffset()); assertTrue(inlay.isValid()); assertEquals(inlayPosition, inlay.getVisualPosition()); // check caret is still to the right assertEquals(new VisualPosition(inlayPosition.line, inlayPosition.column + 1), getEditor().getCaretModel().getVisualPosition()); }