I have a question for Code coverage with Sonar.
In this example :
public static void apply(Person person) {
if (person != null) {
callApply(person);
}
}
In my Sonar Code coverage, i have the following result :
if (person != null) => hit=(10) % = (75%)
callApply(person); => hit(10) % =()
I don’t understand why with the same number of hit, the coverage is 75% ?, and why i don’t have any value coverage when we call the method callApply
I think this version of Sonar use Jacoco for coverage code.
Thank you.
First, Sonar is using Cobertura by default (JaCoCo will be the default one in Sonar 3.2 that will ship during summer 2012).
Then, what makes you think that on the 1rst line you get 75% of coverage while you would have nothing on the 2nd line?