I am trying to increase JUnit test case coverage using Cobertura.
The code has quite a lot of Loggers, and also If conditions to check whether Info or Debug is enabled. Ex:
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Some info...");
}
Now obviously, there will be no Else part for this. The above code will have a 50% branch coverage. How do I make that 100%?
I have tried ignoring Logger calls in instrumentation:
<instrumentation>
<ignores>
<ignore>org.slf4j.Logger.*</ignore>
</ignores>
<excludes>
<exclude>**/Example.class</exclude>
</excludes>
</instrumentation>
But that just brought down the coverage to 0%.
Is there a workaround for this?
Any help would be appreciated.