Tuesday, November 23, 2004

Testing private methods

While researching ways to "sneak around" interfaces and package access (I seem to remember hearing there's some way to do this), I came across this:

http://www.artima.com/suiterunner/private2.html

I'm with Bill on private method testing. Unit testing allows you to test at the granularity of the method, and the reason you break code up into private methods is to manage complexity. But if you can't test at that level, it's defeating.

My guess is that they were backfilling when they said that. Because JUnit can't test private methods, let's say it's a bad thing to do.