CVS: junit/src/junit/framework JUnit4TestAdapter.java, 1.2, 1.3

David Saff <[email protected]> Thu, 26 Apr 2007 12:56:34 -0700
Newsgroups gmane.comp.java.junit.devel
Message-ID <[email protected]>
Update of /cvsroot/junit/junit/src/junit/framework
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1805/src/junit/framework

Modified Files:
	JUnit4TestAdapter.java 
Log Message:
[Junit-trackers] [ junit-Bugs-1684562 ] assertEquals throws NPE while comparing null elements 
Descriptions now have Annotations

Index: JUnit4TestAdapter.java
===================================================================
RCS file: /cvsroot/junit/junit/src/junit/framework/JUnit4TestAdapter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- JUnit4TestAdapter.java	13 Dec 2006 02:10:51 -0000	1.2
+++ JUnit4TestAdapter.java	26 Apr 2007 19:56:31 -0000	1.3
@@ -2,6 +2,7 @@
 
 import java.util.List;
 
+import org.junit.Ignore;
 import org.junit.runner.Description;
 import org.junit.runner.Request;
 import org.junit.runner.Runner;
@@ -43,7 +44,24 @@
 	}
 	
 	public Description getDescription() {
-		return fRunner.getDescription();
+		Description description= fRunner.getDescription();		
+		return removeIgnored(description);
+	}
+
+	private Description removeIgnored(Description description) {
+		if (isIgnored(description))
+			return Description.EMPTY;
+		Description result = description.childlessCopy();
+		for (Description each : description.getChildren()) {
+			Description child= removeIgnored(each);
+			if (! child.isEmpty())
+				result.addChild(child);
+		}
+		return result;
+	}
+
+	private boolean isIgnored(Description description) {
+		return description.getAnnotation(Ignore.class) != null;
 	}
 
 	@Override


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/