Search code examples
javaspringcode-coveragepitest

Pitest gradle, low coverage due to @Data


I tried to get a good coverage file in my java spring project, I mean; see where my tests are good and where they are not. But my problem is that @Data generate a lot of function/class that I don't want to test, and just ruin my coverage.

I already search for a solution, but there is nothing to fix my problem. Looks like Jacoco have something to fix my problem but not Pitest. Maybe Im just not taking the problem right.


Solution

  • Since version 1.2.1 Pitest ignores any method or class annotated with Generated.

    You can configure Lombok to add the annotation by adding the following in lombok.config :

    lombok.addLombokGeneratedAnnotation = true