|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
Problem: Java Comparable Interface with ConstructorI love Cobertura and think that it is a significant contibution in the quest to improve the lives of many around the world... Well done team Cobertura ! I'm using Cobertura 1.9.2 and Java 1.6 with Maven 2 on WindowsVISTA (Yes, Windoze does suck!) I've had NO problem maintaining 100% coverage (not that that is the objective) EXCEPT FOR the following situation that I'm at a loss to account for. I've spent some time Googling and looking on the Cobertura site for answers but have had no luck with resolution to this little annoyance -- I accept that I must have an Obsessive Compulsive personality. I suspect that I'm doing something really dumb but CANNOT for the life of me see what it is. Therefore, your help would be greatly appreciated. Let us assume that I have a really simple HelloWorld class (HelloWorld.java) that implements the interface Comparable<HelloWorld>. Please see below: public final class HelloWorld implements Comparable<HelloWorld> { ... public final int compareTo( HelloWorld other ) { return 0; // this is *NOT* a sound implementation of compareTo(...) } } In a test class, a simple instantiation of HelloWorld and call to compateTo(...) causes Cobertura to report 100% coverage. I love it -- ALL GOOD! HOWEVER, as soon as I add a default/null (no argument) constructor to the HelloWorld class (which implements Comparable<HelloWorld> -- please see below -- then Cobertura reports that the class declaration is NOT covered by testing code: public final class HelloWorld implements Comparable<HelloWorld> // this line reported RED (and I don't understand why) { ... public XXX() { // this method verbose... BUT conceptually sound super(); return; } public final int compareTo( XXX other ) { return 0; } } I cannot see how I can write any testing code to cause Cobertura to report 100% test coverage for my HelloWorld class when (1) HelloWorld implements Comparable<HelloWorld>, and (2) HelloWorld offers a default/null (no argument) constructor ? I'd like to see my Cobertura report 100% ! .... Thanks in advance for you help with what must be a dumb newbie confusion on my part,,, RoyQ ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Cobertura-devel mailing list Cobertura-devel@... https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
| Free embeddable forum powered by Nabble | Forum Help |