PsiMethod (Location location) { final PsiElement psiElement = location.getPsiElement(); final PsiMethod psiMethod = PsiTreeUtil.getParentOfType(psiElement, PsiMethod.class); if (psiMethod != null) { final PsiClass containingClass = psiMethod.getContainingClass(); if (containingClass != null) { final TestFramework testFramework = TestFrameworks.detectFramework(containingClass); if (testFramework != null) { return null; } return psiMethod; } } return null; }