Q:

Sonar Kotlin Object 0% coverage

In my project I created an object to hold some Constants to be used along the project modules, for example, Success/Error messages, but when I run the Sonar scan, it reports the file with 0% coverage.
I tried to test the constants values to check if Sonar would see that as covered, but it didn't, actually it does show the object Messages {} as not covered, not the lines inside:
 
How can I cover it with tests so Sonar won't report it as 0% covered?

A:

The simpliest way to fix it, was to create a test to check if the object is not null
Using Kotlin and JUnit
val obj = Messages
assertNotNull(obj)

