Menu

#1 nodes missed in finally block

open
nobody
None
5
2004-02-29
2004-02-29
Brett Favre
No

I'm using Gretel to build a nice test-coverage report
on my unit
tests. It would be nice to get 100% test-coverage so
that I can
show that every line of the code get's executed. Some
part of my
code has a finally statement in it, like this simple
example:

01 package example;
02
03 public class FinallyExample {
04 public static void main(String args[]) {
05 int i=10;
06 try {
07 i++;
08 } finally {
09 System.out.println("i is "+i);
10 }
11 System.out.println("end.");
12 }
13 }

When I run this code, the line 9 is always marked as
"mixed".
The percentage of complete test-coverage never get's 100%.

Can I get 100% coverage in code with finally statements?

Discussion


Log in to post a comment.