core/src/test/java/com/google/errorprone/bugpatterns/CheckReturnValueTest.java
@Test
  public void testIgnoreCRVOnMockito() {
    compilationHelper
        .addSourceLines(
            "Test.java",
            "package lib;",
            "public class Test {",
            "  @com.google.errorprone.annotations.CheckReturnValue",
            " public int f() {",
            "    return 0;",
            "  }",
            "}")
        .addSourceLines(
            "TestCase.java",
            "import static org.mockito.Mockito.verify;",
            "import static org.mockito.Mockito.doReturn;",
            "import org.mockito.Mockito;",
            "class TestCase {",
            "  void m() {",
            "    lib.Test t = new lib.Test();",
            "    Mockito.verify(t).f();",
            "    verify(t).f();",
            "    doReturn(1).when(t).f();",
            "    Mockito.doReturn(1).when(t).f();",
            "  }",
            "}")
        .doTest();
  }
// Don't match methods invoked through {@link org.mockito.Mockito}.
Don't match methods invoked through  org.mockito.Mockito.
Don ' t match methods invoked through org . mockito . Mockito .
@Test
  public void testIgnoreCRVOnMockito() {
    compilationHelper
        .addSourceLines(
            "Test.java",
            "package lib;",
            "public class Test {",
            "  @com.google.errorprone.annotations.CheckReturnValue",
            " public int f() {",
            "    return 0;",
            "  }",
            "}")
        .addSourceLines(
            "TestCase.java",
            "import static org.mockito.Mockito.verify;",
            "import static org.mockito.Mockito.doReturn;",
            "import org.mockito.Mockito;",
            "class TestCase {",
            "  void m() {",
            "    lib.Test t = new lib.Test();",
            "    Mockito.verify(t).f();",
            "    verify(t).f();",
            "    doReturn(1).when(t).f();",
            "    Mockito.doReturn(1).when(t).f();",
            "  }",
            "}")
        .doTest();
  }
@ Test public void testIgnoreCRVOnMockito ( ) { compilationHelper . addSourceLines ( "Test.java" , "package lib;" , "public class Test {" , "  @com.google.errorprone.annotations.CheckReturnValue" , " public int f() {" , "    return 0;" , "  }" , "}" ) . addSourceLines ( "TestCase.java" , "import static org.mockito.Mockito.verify;" , "import static org.mockito.Mockito.doReturn;" , "import org.mockito.Mockito;" , "class TestCase {" , "  void m() {" , "    lib.Test t = new lib.Test();" , "    Mockito.verify(t).f();" , "    verify(t).f();" , "    doReturn(1).when(t).f();" , "    Mockito.doReturn(1).when(t).f();" , "  }" , "}" ) . doTest ( ) ; }
Don't match methods invoked through {@link org.mockito.Mockito}.
Don ' t match methods invoked through { @link org . mockito . Mockito } .