Excluding Switch on Enum Default case

2012-07-23
2013-04-24
  • Melloware Inc

    Melloware Inc - 2012-07-23

    I have a Java enum and for defensive programming I use a Switch with a default.  This is in case an intern a year from now adds an enum without realizing the consequences.  Since enums are public static final they are difficult to mock or inject and invalid case for testing.  Thus my code coverage is not 100% and my client gets twitchy even though I have explain the problem.   Here is the issue..

    http://stackoverflow.com/questions/5323505/mocking-java-enum-to-add-a-value-to-test-fail-case

    Is there any way in Jacoco to ignore the "default" switch on a switch statement from coverage?

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks