Run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report sonar:sonar
(JaCoCo and) SonarQube report:
- 100% Line coverage (4/4)
- 5.5% Condition coverage (1/18)
- 22.7% overall coverage (5/22)
Change lombok.config.sample file into lombok.config (File contains lombok.addLombokGeneratedAnnotation = true
)
Run again: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report sonar:sonar
(JaCoCo and) SonarQube report:
- 100% Line coverage (1/1)
- 50% Condition coverage (1/2)
- 66.6% overall coverage (2/3)
This looks much more meaningful
If you class does not contain any code except the lombok generated code (unlikely but who knows...) the effect of ignoring lombok code will yield a special result. The jacoco.xml file is present and mentions the Person.java file, but with no lines to cover. As a result SonarQube will display no coverage information (which is different from 0% coverage)
When setting lombok.addLombokGeneratedAnnotation = true
the coverage generated by such unit tests will not be taken into account.
But anyway, when setting lombok.addLombokGeneratedAnnotation = false
the coverage relates to lines that do not exist in the source codes so the results are not any better.