You must do what works for you; here is what works for me:
My module is a class : this is what I am trying to verify. Not a method. I am trying to do object oriented programming, so I paid attention to objects.
If I am tempted to test a private method, I need refactoring . I just want to test the private method directly, because there is too much other code between it and the tests, and because the private method itself is complex enough to require attention checking. So, I usually take out a class to pull this private method and other related members into a new class.
My classes are usually pretty small . They are easy to read and understand. My methods, of course, are also very small and understandable.
Switching to this way of working required me to rethink many of my assumptions and programming habits. What once seemed radical now seems commonplace.
source share