void () { doTest(() -> { myFixture.type("int param"); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); CaretModel model = myFixture.getEditor().getCaretModel(); PsiElement element = myFixture.getElementAtCaret(); PsiMethod method = PsiTreeUtil.getParentOfType(element, PsiMethod.class, false); assertNotNull(method); PsiTypeElement returnTypeElement = method.getReturnTypeElement(); assertNotNull(returnTypeElement); model.moveToOffset(returnTypeElement.getTextRange().getEndOffset()); int i = returnTypeElement.getTextLength(); while (i-- > 0) { myFixture.type('\b'); } myFixture.type("boolean"); }); }