Any way to mark a code block to not require Java Code Coverage in IDEA?

Answered

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

0
2 comments
Avatar
Permanently deleted user

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

0

Please sign in to leave a comment.