Alexei Blue
Alexei Blue

Reputation: 1782

Is it possible to get Emma coverage tool in eclipse to ignore certain lines?

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.

Upvotes: 0

Views: 618

Answers (2)

grimripper
grimripper

Reputation: 71

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.

Upvotes: 1

moeTi
moeTi

Reputation: 3904

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.

Upvotes: 2

Related Questions