Hacker News new | ask | show | jobs
by pan69 4364 days ago
How do you write unit tests for classes like this? A lot of reflection I assume?
1 comments

I only test against the final result, that I expect any public method to produce. The unit test should pay no consideration to the implementation details such as private methods.

If you want to test the fragments in isolation, split it out into a separate class that you use as a dependency. Your desire to do so is often a good indication that you should split up the responsibility.