Steps to reproduce
public class Utils {
public static boolean isNotNullOrEmpty(Map map) {
return map != null && !map.isEmpty();
}
public static boolean isNotNullOrEmpty(Set set) {
return set != null && !set.isEmpty();
}
}
For which I wrote a unit tests as follows -
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class UtilsTest {
@Test
void testUtils() {
assertNotNull(new Utils());
assertFalse(Utils.isNotNullOrEmpty(new HashMap()), "Map utils failure.");
assertFalse(Utils.isNotNullOrEmpty(new HashSet()), "Set utils failure.");
}
}
JaCoCo version:0.7.9
Operating system:MacOSX
Tool integration: Maven
Expected behaviour
The coverage for the isNotNullOrEmpty(Set set) should also be 100%.
Actual behaviour
The branch coverage is 50%.
External Link - http://stackoverflow.com/questions/43264560/jacoco-code-coverage-difference-for-set-and-map
Why is there such an incosistency for Set vs Map util defined in our code.