Does anybody knows about this issue “Insufficient branch coverage by unit tests”? My class code coverage is 99% but I am keep getting sonar warning for that same class “Insufficient branch coverage by unit tests : 111 more branches need to be covered by unit tests to reach the minimum threshold of 65.0% branch coverage.” Normally this error occurred due to Insufficient coverage of if/else condition as we have to handle positive/negative both scenarios. Does anybody knows anything else about this warning?
Thanks Sach
This means that you have branches in your code that are not covered.
For instance :
boolean foo() {
return a || b || c;
}
if in your tests you always have a that is true, then you are covering the line indeed but not all the branches possible.
Please also watch out for try with resources as this generates a lot of branches in bytecode (and you don't see them in source) and you are most probably not covering all of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With