PsiMethodCallExpression[] (PsiMethod method) { return SyntaxTraverser.psiTraverser(method).filter(PsiMethodCallExpression.class) .filter(methodCall -> { final PsiMethod method1 = methodCall.resolveMethod(); if (method1 != null) { final PsiClass containingClass = method1.getContainingClass(); if (containingClass != null) { final String qualifiedName = containingClass.getQualifiedName(); return "junit.framework.Assert".equals(qualifiedName) || "org.junit.Assert".equals(qualifiedName) || "junit.framework.TestCase".equals(qualifiedName); } } return false; }).toArray(new PsiMethodCallExpression[0]); }