Eclipse EclEmma missed instructions
Asked Answered
W

1

6

I'm using Eclipse-STS + EclEmma plugin to see coverage of my code. In all my abstract util classes (with only static methods) I see 3 missed instructions (Instructions Counter report) at the class definition line:

enter image description here

No marker available at the left of the red line, so I do not know exactly what are these instructions. Maybe some constructors? What can I do to cover them?

Warp answered 7/2, 2013 at 23:27 Comment(3)
I don't know the answer to this question, but I am curious as to why this is so important to you. Are you required to get 100% coverage? IMO, coverage tools like Emma are best at signifying weak spots in your testing. If you know these instructions are covered, but emma doesn't show it, that is not a problem with your tests (although it may indicate a bug in emma).Gonzalo
I'm just a perfectionist and want to see that cherished number in reports. Also, I'm just curious.Warp
I get it. :-) Wish I had an answer for you.Gonzalo
W
3

One way I found to achieve 100% covering is to write a test method like this:

@Test
public void coverage(){
    KeyEscaper a = new KeyEscaper() {
    };
}

As soon as the issue touches only utils classes with all static methods, it's not a problem to instantiate them anonimously in such way.

Warp answered 4/3, 2013 at 19:42 Comment(3)
Just doing a new KeyEscaper(); should be enough. Also, you could put it in a static method with @BeforClass so you don't have to create a dummy test.Leavings
Cannot do new, as the class is abstract.Warp
You can combine the two approaches though (anonymous subclass, but without local variable) by simply new KeyEscaper() {};.Engross

© 2022 - 2024 — McMap. All rights reserved.