diff --git a/testing-modules/testing-libraries-2/src/main/java/com/baeldung/jacocoexclusions/generated/Generated.java b/testing-modules/testing-libraries-2/src/main/java/com/baeldung/jacocoexclusions/generated/Generated.java index 93be21e32d..4781c5a613 100644 --- a/testing-modules/testing-libraries-2/src/main/java/com/baeldung/jacocoexclusions/generated/Generated.java +++ b/testing-modules/testing-libraries-2/src/main/java/com/baeldung/jacocoexclusions/generated/Generated.java @@ -4,12 +4,13 @@ import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; +import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; @Documented @Retention(RUNTIME) -@Target({TYPE, METHOD}) +@Target({TYPE, METHOD, CONSTRUCTOR}) public @interface Generated { } \ No newline at end of file diff --git a/testing-modules/testing-libraries-2/src/main/java/com/baeldung/jacocoexclusions/service/CustomerService.java b/testing-modules/testing-libraries-2/src/main/java/com/baeldung/jacocoexclusions/service/CustomerService.java index 889153ba0a..54cba300af 100644 --- a/testing-modules/testing-libraries-2/src/main/java/com/baeldung/jacocoexclusions/service/CustomerService.java +++ b/testing-modules/testing-libraries-2/src/main/java/com/baeldung/jacocoexclusions/service/CustomerService.java @@ -4,6 +4,11 @@ import com.baeldung.jacocoexclusions.generated.Generated; public class CustomerService { + @Generated + public CustomerService(){ + //constructor excluded form coverage report + } + //this method will be excluded from coverage due to @Generated. @Generated public String getProductId() {