Any way to mark a code block to not require Java Code Coverage in IDEA?
IntelliJ IDEA is great. In particular, I really like how easy it makes it for me to use the code coverage tool on my unit tests. I've gotten quite close to 100% coverage, but there are a few things that I'm having trouble covering.
One type of thing I'm having trouble covering is when I have to handle an exception that I don't know how to cause in a test. I can use mocks and interfaces + alternative implementations of a lot of things to force coverage, but not always. For instance, I don't know how to mock a static method in a system library. Here's an example:

Do I need to make an interface or object to provide this service and then mock that? Or is there a magic annotation or comment I can make that says "pretend this block is covered"?
thanks,
ab
Please sign in to leave a comment.
There is an open request for exactly this: https://youtrack.jetbrains.com/issue/IDEA-26988.
Thanks for the pointer!
I've added to that issue and issue 125134 (https://youtrack.jetbrains.com/issue/IDEA-125134) which was marked as its duplicate. It seems like neither is getting much love since the first was filed in 2009.
thanks,
ab