boolean (@NotNull final Location<? extends PsiMethod> location, boolean checkAbstract, boolean checkRunWith, boolean checkClass) { final PsiMethod psiMethod = location.getPsiElement(); final PsiClass aClass = location instanceof MethodLocation ? ((MethodLocation)location).getContainingClass() : psiMethod.getContainingClass(); if (checkClass && (aClass == null || !isTestClass(aClass, checkAbstract, true))) return false; if (psiMethod.isConstructor()) return false; if (psiMethod.hasModifierProperty(PsiModifier.PRIVATE)) return false; if (isTestAnnotated(psiMethod, true)) return !psiMethod.hasModifierProperty(PsiModifier.STATIC); if (aClass != null && MetaAnnotationUtil.isMetaAnnotatedInHierarchy(aClass, Collections.singletonList(CUSTOM_TESTABLE_ANNOTATION))) return true; if (!psiMethod.hasModifierProperty(PsiModifier.PUBLIC)) return false; if (psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) return false; if (AnnotationUtil.isAnnotated(psiMethod, CONFIGURATIONS_ANNOTATION_NAME, 0)) return false; if (checkClass && checkRunWith) { PsiAnnotation annotation = getRunWithAnnotation(aClass); if (annotation != null) { PsiClass containingClass = psiMethod.getContainingClass(); if (containingClass == null || CommonClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) { return false; } return !isOneOf(annotation, RUNNERS_REQUIRE_ANNOTATION_ON_TEST_METHOD); } } if (!psiMethod.getParameterList().isEmpty()) return false; if (psiMethod.hasModifierProperty(PsiModifier.STATIC)) return false; if (!psiMethod.getName().startsWith("test")) return false; if (checkClass) { PsiClass testCaseClass = getTestCaseClassOrNull(aClass); if (psiMethod.getContainingClass() == null) return false; if (testCaseClass == null || !psiMethod.getContainingClass().isInheritor(testCaseClass, true)) return false; } return PsiTypes.voidType().equals(psiMethod.getReturnType()); }