I realize that submitting StackOverflow questions here has become a bit of a "karma whore" (to borrow a phrase from reddit) trend lately, but I stumbled upon this question earlier and thought it might make for good discussion here.
As an extremely junior developer, I don't presume to know everything (or even much) about development, but I thought testing private methods was pretty much a given.
The argument in the accepted answer that "[a] private method is an implementation detail that should be hidden to the users of the class" seems to miss the point, IMO. I mean, an entire codebase is an "implementation detail that should be hidden from the (end) user" but it doesn't mean we shouldn't test it.
I think of unit tests as being tests of the smallest testable chunks of code, to ensure that every atomic piece of an application works to spec. By all means, test the public interface, but I think testing the pieces that make up that interface is important too.
That's two cents from a guy that has never done these sorts of tests anyway, so take it for what it's worth.
As an extremely junior developer, I don't presume to know everything (or even much) about development, but I thought testing private methods was pretty much a given.
The argument in the accepted answer that "[a] private method is an implementation detail that should be hidden to the users of the class" seems to miss the point, IMO. I mean, an entire codebase is an "implementation detail that should be hidden from the (end) user" but it doesn't mean we shouldn't test it.
I think of unit tests as being tests of the smallest testable chunks of code, to ensure that every atomic piece of an application works to spec. By all means, test the public interface, but I think testing the pieces that make up that interface is important too.
That's two cents from a guy that has never done these sorts of tests anyway, so take it for what it's worth.