void (int num) { final PsiElement element = PsiUtilBase.getElementAtCaret(myFixture.getEditor()).getParent().getParent(); assert element instanceof PsiAnonymousClass : "There should be anonymous class at caret but " + element + " found"; assertEquals("$" + num, JavaAnonymousClassesHelper.getName((PsiAnonymousClass)element)); }