Hi Peter, On Thursday, January 11, 2018 at 3:05:10 PM UTC+1, [email protected] wrote:
> 2) On the page https://github.com/jacoco/jacoco/wiki/FilteringOptions Jacoco > filtering options are described. > I want to use JAVAC.ENUM to suppress coverage of values() and valueOf(). > On the side above there is the following statement: "This page discusses a > not yet available feature!", but behind the option JAVAC.ENUM there is the > remark "Done". > Is this feature already implemented in Jacoco? If it is available, in > which version is it implemented and how can i set the filtering option in > the following ANT-script: As of today latest released JaCoCo version 0.8.0 includes all filters that are marked on mentioned page as "done". No special activation/configuration is required - just use version 0.8.0. wiki is primarly used by JaCoCo developers to analyze and design new features, user documentation as always located at http://www.jacoco.org/jacoco/ , and includes full change log - http://www.jacoco.org/jacoco/trunk/doc/changes.html > 1) We have a problem with the following construct: > > public final int getId() { > int retValue = -1; > switch (getDevice()) { > case MIREL1: > retValue = 1; > break; > case MIREL2: > retValue = 2; > break; > default: > getMyTestScript().error("Invalid device!"); > break; > } > return retValue; > } > > All 3 branches are covered, but "switch getDevice()" is marked yellow. On > internet i found the info, that getId() can return null and then a > Exception is thrown. > > I generated a 4.th test case via mocking getId() to null. > "*int* getId()" can't return null ;) > Then a nullptrexception is thrown, i tested this in the unit-test, but > Jacoco always marks the row "switch getDevice()" yellow and the static > coverage is not 100%. > How can we solve this problem? > Not even counting the above about int and null, in absence of complete executable example hard to understand what you're trying to describe - no explanation of "getDevice" / "MIREL1" / "getMyTestScript().error" / etc, tests not shown, no even screenshot of report. -- 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/f3b9d9ae-1876-4adc-bcd2-666aff439d72%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
