private static boolean isTestClass(@Nullable Class<?> clazz) {
    return clazz != null
        && (JUNIT_TEST_CASE.equals(clazz.getCanonicalName())
            || hasAnnotation(clazz.getAnnotations(), JUNIT_RUN_WITH)
            || isTestClass(clazz.getSuperclass()));
  }
Get the current test name in a standard JUnit3 or JUnit4 test, or "unknown" if we couldn't
detect it.
core/src/main/java/com/facebook/testing/screenshot/internal/TestNameDetector.java