core/src/main/java/com/google/errorprone/bugpatterns/JUnit3TestNotRun.java
public Optional<Description> checkMethod(
      MethodTree methodTree, ImmutableSet<MethodSymbol> calledMethods, VisitorState state) {
    if (calledMethods.contains(getSymbol(methodTree))) {
      return Optional.empty();
    }
    if (!LOOKS_LIKE_TEST_CASE.matches(methodTree, state)) {
      return Optional.empty();
    }
    if (!findSuperMethods(getSymbol(methodTree), state.getTypes()).isEmpty()) {
      return Optional.empty();
    }

    SuggestedFix.Builder fix = SuggestedFix.builder();

    String methodName = methodTree.getName().toString();
    if (!methodName.startsWith("test")) {
      var matcher = MISSPELLED_NAME.matcher(methodName);
      String fixedName;
      if (matcher.lookingAt()) {
        fixedName = matcher.replaceFirst("test");
      } else if (wouldRunInJUnit4.matches(methodTree, state)) {
        fixedName = "test" + toUpperCase(methodName.substring(0, 1)) + methodName.substring(1);
      } else {
        return Optional.empty();
      }
      fix.merge(renameMethod(methodTree, fixedName, state));
    }

    addModifiers(methodTree, state, Modifier.PUBLIC).ifPresent(fix::merge);
    removeModifiers(methodTree, state, Modifier.PRIVATE, Modifier.PROTECTED).ifPresent(fix::merge);
    // N.B. must occur in separate step because removeModifiers only removes one modifier at a time.
    removeModifiers(methodTree, state, Modifier.STATIC).ifPresent(fix::merge);

    return Optional.of(describeMatch(methodTree, fix.build()));
  }
/**
   * Matches iff:
   *
   * <ul>
   *   <li>Method's name begins with misspelled variation of "test".
   *   <li>Method is public, returns void, and has no parameters.
   *   <li>Enclosing class is JUnit3 test (extends TestCase, has no {@code @RunWith} annotation, no
   *       {@code @Test}-annotated methods, and is not abstract).
   * </ul>
   */
Matches iff:

Method's name begins with misspelled variation of "test".
Method is public, returns void, and has no parameters.
Enclosing class is JUnit3 test (extends TestCase, has no   annotation, no
-annotated methods, and is not abstract).
Matches iff : Method ' s name begins with misspelled variation of " test " . Method is public returns void and has no parameters . Enclosing class is JUnit3 test ( extends TestCase has no annotation no - annotated methods and is not abstract ) .
public Optional<Description> checkMethod(
      MethodTree methodTree, ImmutableSet<MethodSymbol> calledMethods, VisitorState state) {
    if (calledMethods.contains(getSymbol(methodTree))) {
      return Optional.empty();
    }
    if (!LOOKS_LIKE_TEST_CASE.matches(methodTree, state)) {
      return Optional.empty();
    }
    if (!findSuperMethods(getSymbol(methodTree), state.getTypes()).isEmpty()) {
      return Optional.empty();
    }
    SuggestedFix.Builder fix = SuggestedFix.builder();
    String methodName = methodTree.getName().toString();
    if (!methodName.startsWith("test")) {
      var matcher = MISSPELLED_NAME.matcher(methodName);
      String fixedName;
      if (matcher.lookingAt()) {
        fixedName = matcher.replaceFirst("test");
      } else if (wouldRunInJUnit4.matches(methodTree, state)) {
        fixedName = "test" + toUpperCase(methodName.substring(0, 1)) + methodName.substring(1);
      } else {
        return Optional.empty();
      }
      fix.merge(renameMethod(methodTree, fixedName, state));
    }
    addModifiers(methodTree, state, Modifier.PUBLIC).ifPresent(fix::merge);
    removeModifiers(methodTree, state, Modifier.PRIVATE, Modifier.PROTECTED).ifPresent(fix::merge);
    removeModifiers(methodTree, state, Modifier.STATIC).ifPresent(fix::merge);
    return Optional.of(describeMatch(methodTree, fix.build()));
  }
public Optional < Description > checkMethod ( MethodTree methodTree , ImmutableSet < MethodSymbol > calledMethods , VisitorState state ) { if ( calledMethods . contains ( getSymbol ( methodTree ) ) ) { return Optional . empty ( ) ; } if ( ! LOOKS_LIKE_TEST_CASE . matches ( methodTree , state ) ) { return Optional . empty ( ) ; } if ( ! findSuperMethods ( getSymbol ( methodTree ) , state . getTypes ( ) ) . isEmpty ( ) ) { return Optional . empty ( ) ; } SuggestedFix . Builder fix = SuggestedFix . builder ( ) ; String methodName = methodTree . getName ( ) . toString ( ) ; if ( ! methodName . startsWith ( "test" ) ) { var matcher = MISSPELLED_NAME . matcher ( methodName ) ; String fixedName ; if ( matcher . lookingAt ( ) ) { fixedName = matcher . replaceFirst ( "test" ) ; } else if ( wouldRunInJUnit4 . matches ( methodTree , state ) ) { fixedName = "test" + toUpperCase ( methodName . substring ( 0 , 1 ) ) + methodName . substring ( 1 ) ; } else { return Optional . empty ( ) ; } fix . merge ( renameMethod ( methodTree , fixedName , state ) ) ; } addModifiers ( methodTree , state , Modifier . PUBLIC ) . ifPresent ( fix :: merge ) ; removeModifiers ( methodTree , state , Modifier . PRIVATE , Modifier . PROTECTED ) . ifPresent ( fix :: merge ) ; removeModifiers ( methodTree , state , Modifier . STATIC ) . ifPresent ( fix :: merge ) ; return Optional . of ( describeMatch ( methodTree , fix . build ( ) ) ) ; }
Matches iff:
 <ul>
   <li>Method's name begins with misspelled variation of "test".
Matches iff : <ul > <li > Method ' s name begins with misspelled variation of " test " .
// N.B. must occur in separate step because removeModifiers only removes one modifier at a time.