I am using following annotation to exclude class from jacoco coverage
@Target({ElementType.TYPE,ElementType.METHOD})
public @interface ExcludeFromJacocoGeneratedReport {
}
I wanted to exclude following class from coverage report
@ExcludeFromJacocoGeneratedReport
class MyCustomClass {
public void doingSomethingImportant(){
CustomAnonymousclass obj =
// this shows up as red in jacoco report coverage, ideally it shouldn't as i have already excluded the whole class using ExcludeFromJacocoGeneratedReport annotation.
new CustomAnonymousclass() {
public void init(){
/// doing some stuff here
}
};
}
public void doingSomething(){
// doing some stuff here.
}
}
Annoymous class should automatically get excluded from jacoco coverage report but its not happening and showing 0% coverage.