Improve Lombok @Data Code Coverage

In 0.8.0 release, Jacoco added support for filtering out all methods annotated with @lombok.Generated from their reports. The only thing you need to change is to add lombok.config to the root of your project with the following settings:

config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
  • config.stopBubbling = true tells Lombok that this is your root
    directory and that it should not search parent directories for more
    configuration files (you can have more than one lombok config files
    in different directories/packages).
  • lombok.addLombokGeneratedAnnotation = true will add @lombok.Generated
    annotation to all Lombok generated methods.

And that’s it. Jacoco will filter Lombok auto-generated methods, and if you give your best, your code coverage could be close to 100% :))

Leave a Comment