The point of this annotation is its agreement and can be used in the analysis of static code.
Change the visibility of your method to package . In this case, your method reduces the visibility for testing and is available only for tests in one package.
public class Foo { public void bar() { } @VisibleForTesting void baz() { } }
source share