void () { configureFromFileText("A.java", """ class A {{ final Object o = new Object() { @Override public String toString() { return super.toString(); } }; o.to<caret>String(); }}"""); PsiElement element = GotoDeclarationAction.findTargetElement(getProject(), getEditor(), getEditor().getCaretModel().getOffset()); assertInstanceOf(element, PsiMethod.class); PsiClass containingClass = ((PsiMethod)element).getContainingClass(); assertInstanceOf(containingClass, PsiAnonymousClass.class); }