re: It’s Okay to Test Private Methods VIEW POST


Test what you need to test and build it as it needs to be built. Having everything in private methods sounds like a Java problem.


To some extent, it definitely is a Java problem. For instance, nothing is really stopping you from testing private Python methods. Meanwhile, one of the only ways to test a Java private method is through reflection.

That said, private methods are also a consequence of philosophical ideas like encapsulation and abstraction. In other words, we like to hide behavior to protect our users from making mistakes. As a result, testing becomes a bit more of a roundabout process.

code of conduct - report abuse