I am using Jacoco-Maven Plugin for Scala Test Coverage, But when I run the tests I see in Index.html in Jacoco the Singleton Objects are getting Covered twice where one gives the Correct Coverage and the other gives a wrong Coverage Number.
Image:
I am using Jacoco-Maven Plugin for Scala Test Coverage, But when I run the tests I see in Index.html in Jacoco the Singleton Objects are getting Covered twice where one gives the Correct Coverage and the other gives a wrong Coverage Number.
Image:
Jacoco checks coverage of compiled code, not raw Scala code. I believe that in your compiled code there is a private constructor of the class which is not cover by any test and that cause the coverage deficit. You have to investigate the compiled code to verify. However, there is a way to eliminate this problem: adding a trail.
trail XConverter
object XConverter {
def doSomething() = {}
}
Run the jacoco coverage again you will see that the deficit coverage disappear. This is equivalent to having static methods in an interface in Java, no hidden constructor.