android - Unit test private and static methods in java -


i'm writing unit tests app of mine , practice try make methods in classes private possible, may end classes private methods, few public ones , calls static methods (either of other classes or textutils, etc)

i know how test of classes trying rely on mockito , junit since robolectric , powermockito seem stretch boundaries of should done in unit testing. should disregard private , static methods along public methods chance call static or private ones? or how?

all of private methods in class you're testing should called public/protected/package private method; otherwise they're unused code. so, concentrate on testing public api that's visible "client code" of app. internals (private methods) tested/covered side effect because implement public contract api specifies.

testing implementation details (private methods) directly make tests harder maintain , code-under-test more difficult refactor.


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -