Blog

Posts Tagged ‘reflection

23 Jan, 2009

Unit testing private methods in Java

Posted by: admin In: Programming

Want to unit test a private method in Java?
You could obviously change your methods access modifier from private. By making it public you’re breaking encapsulation and by making it protected you’re making your API less intuitive. Don’t do that.
Another way to go about this is to create a new class that’s extending the one with [...]