Your appeal to testability as justification for completely dropping private modifier is wrong, as evidenced eg by the answers in http://programmers.stackexchange.com/questions/135047/new-to-tdd-should-i-avoid-private-methods-nowShould I avoid private methods if I perform TDD?
New test ensures that expected behavior for this usage won't change without a notice since if it changes, test will fail.
An outside reader may look into this test and learnlearn how it is supposed to use and behave (here, outside reader includes my future self, since I tend to forget the code a month or two after I'm done with it).
New test is tolerant to refactoring (do I refactor private methods? you bet!) Whatever I do to
privateMethod
, I'll always want to testnonPrivateMethod(true)
. No matter what I do toprivateMethod
, there will be no need to modify test because method isn't directly invoked.