Knowing what to test is difficult, but the important question you should always ask yourself is;
“Am I just writing this test to increase the code coverage?”
If the answer is yes, then chances are that test isn’t adding any value. Let’s look at an example I like to use;
Here we have a custom exception, something that we probably throw from one of our methods to give us an opportunity to handle a specific case. If I were to write a test for this class, I wouldn’t be testing any functionality as there is none. So the right thing to do is not to write a test.
In this blog post http://labs.ig.com/code-coverage-100-percent-tragedy the author describes developers caught up in the mindset of achieving 100% coverage. These developers aren’t adding any value to their code base, instead they’re just writing tests to increase the coverage.
So when someone asks you, “what should I unit test?” You should say;
Just don’t do it for the sake of increasing code coverage.