Permalink
Browse files

Fix in the annotation-based coverage testing: if classes do not have …

…an explicit constructor, they gave a false positive in the coverage testing. I am now talking advantage of the annotations array to be empty, for the implicit constructors Java adds itself, though private constructors have no annotation either. However, those do not need testing, as they are already typically indirectly tested.

Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information...
1 parent a4fd02c commit 4737199935091b446de118ac31227c8f2e25c11a @egonw egonw committed with rajarshi Jun 22, 2011
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/test/org/openscience/cdk/coverage/CoverageAnnotationTest.java
@@ -105,6 +105,10 @@ private int checkClass(String className) {
if (constructor.getName().startsWith("access$")) {
// skip this test
+ } else if (constructor.getAnnotations().length == 0) {
+ // the constructor is private or implicitly defined because the class does not specify
+ // any constructor at all (like CDKConstants)
+ // -> skip this test
} else if (testMethodAnnotation == null) {
// if a method does not have the annotation, it's missing a test
System.out.println(className + toString(constructor) + " does not have a test method");

0 comments on commit 4737199

Please sign in to comment.