PsiElement () { final PsiClass cls = TestNGUtil.getProviderClass(getElement(), PsiUtil.getTopLevelClass(getElement())); if (cls != null) { PsiMethod[] methods = cls.getAllMethods(); @NonNls String val = getValue(); for (PsiMethod method : methods) { PsiAnnotation dataProviderAnnotation = AnnotationUtil.findAnnotation(method, DataProvider.class.getName()); if (dataProviderAnnotation != null) { final PsiAnnotationMemberValue dataProviderMethodName = dataProviderAnnotation.findDeclaredAttributeValue("name"); if (dataProviderMethodName != null && val.equals(StringUtil.unquoteString(dataProviderMethodName.getText()))) { return method; } if (val.equals(method.getName())) { return method; } } } } return null; }