WesternGun
WesternGun

Reputation: 12758

How to ignore lombok.@UtilityClass for Jacoco?

I have used lombok.@UtilityClass to:

And Jacoco does not cover Lombok generated code. If I explicitly define a private constructor, Jacoco can recognize it.

So, any way to avoid coverage penalty due to usage of @UtilityClass?

Upvotes: 8

Views: 2440

Answers (1)

WesternGun
WesternGun

Reputation: 12758

Well, it turns out that the same can be done to solve this, as what we do to ignore any Lombok generated code: add lombok.config file in the project root with these lines:

# this is root dir and don't search for parent
config.stopBubbling = true
# add @Generated and Jacoco will detect Lombok generated code and ignore them in reports
lombok.addLombokGeneratedAnnotation = true

Upvotes: 6

Related Questions