check_api/src/main/java/com/google/errorprone/matchers/UnusedReturnValueMatcher.java
public static boolean expectedExceptionTest(VisitorState state) {
    // Allow unused return values in tests that check for thrown exceptions, e.g.:
    //
    // try {
    //   Foo.newFoo(-1);
    //   fail();
    // } catch (IllegalArgumentException expected) {
    // }
    //
    StatementTree statement = findEnclosingNode(state.getPath(), StatementTree.class);
    return statement != null && EXPECTED_EXCEPTION_MATCHER.matches(statement, state);
  }
/** Allow return values to be ignored in tests that expect an exception to be thrown. */
Allow return values to be ignored in tests that expect an exception to be thrown.
Allow return values to be ignored in tests that expect an exception to be thrown .
public static boolean expectedExceptionTest(VisitorState state) {
     try {
       Foo.newFoo(-1);
       fail();
     } catch (IllegalArgumentException expected) {
     }
    StatementTree statement = findEnclosingNode(state.getPath(), StatementTree.class);
    return statement != null && EXPECTED_EXCEPTION_MATCHER.matches(statement, state);
  }
public static boolean expectedExceptionTest ( VisitorState state ) { StatementTree statement = findEnclosingNode ( state . getPath ( ) , StatementTree . class ) ; return statement != null && EXPECTED_EXCEPTION_MATCHER . matches ( statement , state ) ; }
Allow return values to be ignored in tests that expect an exception to be thrown.
Allow return values to be ignored in tests that expect an exception to be thrown .
// Allow unused return values in tests that check for thrown exceptions, e.g.: // // try { //   Foo.newFoo(-1); //   fail(); // } catch (IllegalArgumentException expected) { // } //