PsiMethod () { final String filePath = getBasePath() + getTestName(false) + ".java"; configureByFile(filePath); final PsiElement targetElement = TargetElementUtil.findTargetElement(getEditor(), TargetElementUtil.ELEMENT_NAME_ACCEPTED); assertTrue("<caret> is not on method name", targetElement instanceof PsiMethod); return (PsiMethod) targetElement; }