0
votes

I'm using Emma coverage tool in eclipse when using unit tests to see my coverage for each test. However certain lines don't get covered for instant the class declaration in an abstract class:

public abstract class ... {

Is it possible to either get Emma to cover this line or - preferably - ignore it?

Thanks, Alexei Blue.

2

2 Answers

2
votes

Emma already ignores lines that can't be reached, such as class declarations. they are not marked as covered, but also don't count to the overall lines.

i just verified it with this code:

import junit.framework.TestCase;
public class Test extends TestCase {

    public void testSomething() {

        assertTrue(new Check().check());
    }   
}
abstract class AbstractCheck {

    protected abstract boolean check();
}
class Check extends AbstractCheck {

    @Override
    protected boolean check() {
        return true;
    }
}

it returns 100% coverage.

1
votes

I've got an abstract class which has a bunch of static methods but nothing else. The class declaration was not covered. I added this in a JUnit test method:

new AbstractClass() {

};

The class declaration was covered. Getting it covered outside of JUnit tests is another matter though, since there are no subclasses.