Hi Peter,
this is a known issue with synthetic classes created by the JDK
compiler. Future versions of JaCoCo might ignore these classes, see
https://github.com/jacoco/jacoco/issues/660
Regards,
-marc
On 2018-03-21 12:01, [email protected] wrote:
Hi,
we used Junit to trigger the code-coverage and have a problem with the
following construct:
public final double getAntennaDistance(EnumSample cabin) {
switch (cabin) {
case ONE:
return 10.5;// in m
case TWO:
return 129.5;
default:
System.out.println("Cab: " + cabin + " is not valid!");
return -1;
}
}
In the html-output of jacoco "all 3 branches" are covered but the
switch statement is marked as yellow. And in the overview
EnumSample.new Object() {} there is only a coverage of 89%. Is it
possible to get 100% coverage for this case and what must we do?
I extracted a simple example (only 2 classes, and 1 testclass) from
our project and zipped it to the following location:
https://www.dropbox.com/s/3ijf8b90fn8e42m/coveragetestsample.7z?dl=0
To run the example Apache ANT and JDK must be in the classpath, all
aother dependencies are located in the ZIP file: We use Ant version
1.10.2 and JDK 1.8.0_144. We use Powermock (not in this easy example)
together with jacoco and have implemented an ant-script for this.
to clean the sample project: open console, go to coveragetestsample
and put in the command "ant clean".
to build the project with jacoco coverage put in the comand "ant
report".
Best Regards
Peter
--
You received this message because you are subscribed to the Google Groups "JaCoCo
and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jacoco/3076880ba59c5894bb532960f7e3f1a0%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.