public static String getTestName() {
    StackTraceElement[] stack = new Throwable().getStackTrace();
    StackTraceElement testElement = getFirstTestElement(stack);
    if (testElement == null) {
      return UNKNOWN;
    }
    String methodName = testElement.getMethodName();
    for (StackTraceElement element : stack) {
      if (testElement.getClassName().equals(element.getClassName())) {
        methodName = element.getMethodName();
      }
    }
    return methodName;
  }
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