CVS: junit/src/org/junit/runner Request.java, 1.2, 1.3 RunWith.java, 1.1, 1.2

David Saff <[email protected]>
Newsgroups gmane.comp.java.junit.devel
Message-ID <[email protected]>
Update of /cvsroot/junit/junit/src/org/junit/runner
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2290/src/org/junit/runner

Modified Files:
	Request.java RunWith.java 
Log Message:
Fixing exception handling and documentation

Index: Request.java
===================================================================
RCS file: /cvsroot/junit/junit/src/org/junit/runner/Request.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Request.java	13 Dec 2006 02:10:50 -0000	1.2
+++ Request.java	21 Feb 2007 20:26:29 -0000	1.3
@@ -102,9 +102,27 @@
 		});
 	}
 
+	//TODO add an example
 	/**
 	 * Returns a Request whose Tests can be run in a certain order, defined by 
 	 * <code>comparator</code>
+	 * 
+	 * For example, here is code to run a test suite in alphabetical order:
+	 * 
+	 * <pre>
+	private static Comparator<Description> forward() {
+		return new Comparator<Description>() {
+			public int compare(Description o1, Description o2) {
+				return o1.getDisplayName().compareTo(o2.getDisplayName());
+			}
+		};
+	}
+	
+	public static main() {
+		new JUnitCore().run(Request.aClass(AllTests.class).sortWith(forward()));
+	}
+	 * </pre>
+	 * 
 	 * @param comparator definition of the order of the tests in this Request
 	 * @return a Request with ordered Tests
 	 */

Index: RunWith.java
===================================================================
RCS file: /cvsroot/junit/junit/src/org/junit/runner/RunWith.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- RunWith.java	21 Nov 2006 18:53:39 -0000	1.1
+++ RunWith.java	21 Feb 2007 20:26:29 -0000	1.2
@@ -6,7 +6,6 @@
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
-//TODO add simple example
 /**
  * When a class is annotated with <code>&#064;RunWith</code> or extends a class annotated 
  * with <code>&#064;RunWith</code>, JUnit will invoke the class it references to run the 
@@ -14,6 +13,15 @@
  * in development. While it seems powerful we expect the runner API to change as we learn 
  * how people really use it. Some of the classes that are currently internal will likely 
  * be refined and become public.
+ * 
+ * For example, suites in JUnit 4 are built using RunWith, and a custom runner named Suite:
+ * 
+ * <pre>
+ * &#064;RunWith(Suite.class)
+ * &#064;SuiteClasses(ATest.class, BTest.class, CTest.class)
+ * public class ABCSuite {
+ * }
+ * </pre>
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.TYPE)


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.