Jacoco adds magic number to class name when jacocoTestCoverageVerification fails

plugins

(Sergey) #1

Hi, I use Gradle 4.9 and Jacoco plugin 0.8.0. When I run jacocoTestCoverageVerification task and some of my classes violate the rule I got the following message in the console:

Task :jacocoTestCoverageVerification FAILED
[ant:jacocoReport] Rule violated for class MyClass.1: instructions covered ratio is 0.0000, but expected minimum is 0.0001

The issue is that I do not have class with name MyClass.1. The only class I have is MyClass.
Jacoco adds number after the class name. And in order to exclude the class I have to write something like this:

jacocoTestCoverageVerification {
    violationRules {
        rule {
            element = 'CLASS'
            excludes = [
                    'MyClass.1'
           ]
    }
  }
}

Could anyone help to solve the issue or at least explain the behaviour?