void () { final PsiReference ref = getFile().findReferenceAt(getEditor().getCaretModel().getOffset()); assertInstanceOf(ref, PsiJavaCodeReferenceElement.class); final PsiElement parent = ((PsiJavaCodeReferenceElement)ref).getParent(); assertInstanceOf(parent, PsiNewExpression.class); PsiMethod method = ((PsiNewExpression)parent).resolveConstructor(); method = (PsiMethod)method.getNavigationElement(); InlineObjectProcessor processor = InlineObjectProcessor.create(ref, method); assertNotNull(processor); processor.run(); }