[BAEL-4406] Move maven code to testing-libraries-2
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
package com.baeldung.jacocoexclusions.config;
|
||||
|
||||
import com.baeldung.jacocoexclusions.service.ProductService;
|
||||
|
||||
public class AppConfig {
|
||||
|
||||
public ProductService productService() {
|
||||
return new ProductService();
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.baeldung.jacocoexclusions.domain;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Builder
|
||||
@Data
|
||||
public class Product {
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package com.baeldung.jacocoexclusions.dto;
|
||||
|
||||
public class ExcludedPOJO {
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package com.baeldung.jacocoexclusions.dto;
|
||||
|
||||
public class ProductDTO {
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.baeldung.jacocoexclusions.generated;
|
||||
|
||||
@Generated
|
||||
public class Customer {
|
||||
// everything in this class will be excluded from jacoco report because of @Generated
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Customer{}";
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.baeldung.jacocoexclusions.generated;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
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})
|
||||
public @interface Generated {
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.baeldung.jacocoexclusions.service;
|
||||
|
||||
import com.baeldung.jacocoexclusions.generated.Generated;
|
||||
|
||||
public class CustomerService {
|
||||
|
||||
//this method will be excluded from coverage due to @Generated.
|
||||
@Generated
|
||||
public String getProductId() {
|
||||
return "An ID";
|
||||
}
|
||||
|
||||
public String getCustomerName() {
|
||||
return "some name";
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.baeldung.jacocoexclusions.service;
|
||||
|
||||
public class ProductService {
|
||||
private static final double DISCOUNT = 0.25;
|
||||
|
||||
public double getSalePrice(double originalPrice) {
|
||||
return originalPrice - originalPrice * DISCOUNT;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user