[JAVA-15438] Added example to showcase @Generated on constructors (#12946)
Co-authored-by: panagiotiskakos <panagiotis.kakos@libra-is.com>
This commit is contained in:
parent
fad70d5b4e
commit
c97bebc822
|
@ -4,12 +4,13 @@ import java.lang.annotation.Documented;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.Target;
|
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.METHOD;
|
||||||
import static java.lang.annotation.ElementType.TYPE;
|
import static java.lang.annotation.ElementType.TYPE;
|
||||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
@Documented
|
@Documented
|
||||||
@Retention(RUNTIME)
|
@Retention(RUNTIME)
|
||||||
@Target({TYPE, METHOD})
|
@Target({TYPE, METHOD, CONSTRUCTOR})
|
||||||
public @interface Generated {
|
public @interface Generated {
|
||||||
}
|
}
|
|
@ -4,6 +4,11 @@ import com.baeldung.jacocoexclusions.generated.Generated;
|
||||||
|
|
||||||
public class CustomerService {
|
public class CustomerService {
|
||||||
|
|
||||||
|
@Generated
|
||||||
|
public CustomerService(){
|
||||||
|
//constructor excluded form coverage report
|
||||||
|
}
|
||||||
|
|
||||||
//this method will be excluded from coverage due to @Generated.
|
//this method will be excluded from coverage due to @Generated.
|
||||||
@Generated
|
@Generated
|
||||||
public String getProductId() {
|
public String getProductId() {
|
||||||
|
|
Loading…
Reference in New Issue