Issue
I use JaCOCO to see code coverage (and use the Intellij plugin for it). I have @SneakyThrows of lombok on my code. Since @SneakyThrows does nothing but converting a checked exception to a unchecked exception, I hope it does not affect the code coverage.
However, it seems that it drops the code coverage:
I have tried to add lombok.addLombokGeneratedAnnotation = true
to my lombok.config
, but no use.
Thanks for any suggestions!
Solution
You can't ignore a certain code path, jacoco has no support for that (neither it can ignore a method). Its unit of measure, for a lack of better term, is a .class
file. Since jacoco looks at the .class
file, that is generated after lombok processor kicks in, for it - you simply have path that is un-tested.
In simpler words, jacoco
sees your file like it never had lombok annotations. So you can't "exclude" an annotation. I feel your pain - we have modules where people have enforced a very high number of coverage, and these catch blocks are un-tested, almost all the time.
Answered By - Eugene
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)