-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Ignore switch case default cases which can't be covered #1211
Copy link
Copy link
Open
Description
Scenario
- JaCoCo version: (from right bottom corner of JaCoCo report)
- 0.8.6
- Operating system:
- Windows
- Tool integration: Maven / Ant / CLI / API
- Maven
- Description of your use case:
Java Switch default cased can't be convered if all other cases are covered:
switch (enum) {
case CASE_1:
doSomething();
break;
case CASE_2:
doSomethingElse();
break;
default:
//Throw Exception in case a new Enum value is added in future and not yet supported
throw new UnsupportedOperationException("Not supported enum: " + enum.getName());
}
Jacoco should add an option to ignore/mark switch default cases as covered.
Current Behaviour
Switch default cases are makred as uncovered in case all other cases are covered even if coverage is not possible.
Wanted Behaviour
Jacoco should add an option to ignore/mark switch default cases as covered.
If possible Jacoco can check if all other cases are covered first, if not then a simple config option would be enough.
Possible Workarounds
Add unwanted Enums like UNKOWN or DEFAULT and try to cover default case with them.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Projects
Status
Awaiting triage