Search code examples
javacode-coverageemma

Why isn't this statement marked as completely covered by eclemma?


I am using EclEmma in Eclipse (more specifically, RSA 8). I have the following statement in my code:

public static boolean isEmpty(Collection collection) {
    return (collection == null) || collection.isEmpty();
}

and I have the following tests:

@Test public void isEmpty_nullCase() {
    assertTrue(CollectionUtil.isEmpty(null));
}
@Test public void isEmpty_listCase() {
    assertTrue(CollectionUtil.isEmpty(new ArrayList()));
}

but for some reason, the statement is showing up as yellow. What part of it am I not testing?

Thanks, Peter


Solution

  • How about an ArrayList that has a value, and is therefore not empty?