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

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -