android - @VisibleForTesting does not work as expected -


i wanted try @visiblefortesting annotation android unit-test - have class 1 annotated method:

public class foo {    public void bar() {   }    @visiblefortesting   private void baz() {   } } 

but in unit-tests still can see bar - not baz

the point of annotation convention , used in static code analysis.

change visibility of method package. in case method has reduced visibility testing , visible tests in same package.

public class foo {    public void bar() {   }    @visiblefortesting   /* package */ void baz() {   } } 

Comments

Popular posts from this blog

r - how do you merge two data frames the best way? -

How to debug "expected android.widget.TextView but found java.lang.string" in Android? -

php - mySQL problems with this code? -