Location (Project project, String fileName, String nameWithoutExtension, PsiClass aClass) { final PsiAnnotation annotation = AnnotationUtil.findAnnotation(aClass, TestFrameworkConstants.TEST_DATA_PATH_ANNOTATION_QUALIFIED_NAME); if (annotation != null) { final Location parameterizedLocation = PsiMemberParameterizedLocation.getParameterizedLocation(aClass, "[" + fileName + "]", TestFrameworkConstants.PARAMETERIZED_ANNOTATION_QUALIFIED_NAME); if (parameterizedLocation != null) { return parameterizedLocation; } if (StringUtil.isJavaIdentifier(nameWithoutExtension)) { final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project); PsiMethod method = aClass.findMethodBySignature(elementFactory.createMethod("test" + nameWithoutExtension, PsiTypes.voidType()), true); if (method != null) { return MethodLocation.elementInClass(method, aClass); } method = aClass.findMethodBySignature(elementFactory.createMethod("test" + StringUtil.capitalize(nameWithoutExtension), PsiTypes.voidType()), true); if (method != null) { return MethodLocation.elementInClass(method, aClass); } } return new PsiLocation<PsiElement>(project, aClass); } return null; }