4

I have tried AndroidStudio's code coverage feature and I have met a strange issue:

It is marks the tested class's name as 'not covered' code. How is that possible? Is that a bug?

Picture here:

enter image description here

As you can see it has one method with 4 lines and each one of them is covered. So why is the red line at the class's name?

Adam Varhegyi
  • 12,015
  • 32
  • 115
  • 205

2 Answers2

5

You are using a static method, so the class itself is never created as an object, therefore never testing that ability.

Stefan
  • 1,958
  • 2
  • 17
  • 29
2

I tried the lombok @UtilityClass, it helped to ignore the class name and code coverage was improved to be 100%.

thundear
  • 108
  • 6