public class TestClass
{
public void test(TestEnum type)
{
switch(type)
{
case one:
System.out.println("one");
break;
case two:
System.out.println("two");
break;
case three:
System.out.println("three");
break;
}
}
}
It seems that I cannot get 100% code coverage with Emma when I switch on an Enum. The tool says that 51 of 54 instructions were covered and the line with "public class TestClass" is yellow. If I go to the properties on the class it says the Basic Blocks count is 80% with 12 out of 15 instructions being covered. If I swap the switch with if-else statements then 100% coverage is achieved. Is there a way to get 100% coverage when switching on an Enum?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Consider the following code:
public class TestClass
{
public void test(TestEnum type)
{
switch(type)
{
case one:
System.out.println("one");
break;
case two:
System.out.println("two");
break;
case three:
System.out.println("three");
break;
}
}
}
It seems that I cannot get 100% code coverage with Emma when I switch on an Enum. The tool says that 51 of 54 instructions were covered and the line with "public class TestClass" is yellow. If I go to the properties on the class it says the Basic Blocks count is 80% with 12 out of 15 instructions being covered. If I swap the switch with if-else statements then 100% coverage is achieved. Is there a way to get 100% coverage when switching on an Enum?