CVS: junit/src/org/junit/tests RunWithTest.java, 1.2, 1.3 AllTests.java, 1.8, 1.9
David Saff <[email protected]>
| Newsgroups | gmane.comp.java.junit.devel |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/junit/junit/src/org/junit/tests
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11377/src/org/junit/tests
Modified Files:
RunWithTest.java AllTests.java
Log Message:
Better error message when a custom runner has a wrongly-signatured constructor
Index: RunWithTest.java
===================================================================
RCS file: /cvsroot/junit/junit/src/org/junit/tests/RunWithTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- RunWithTest.java 6 Dec 2006 01:22:48 -0000 1.2
+++ RunWithTest.java 21 Feb 2007 17:12:37 -0000 1.3
@@ -1,6 +1,6 @@
package org.junit.tests;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
@@ -57,4 +57,28 @@
JUnitCore.runClasses(SubExampleTest.class);
assertTrue(log.contains("run"));
}
+
+ public static class BadRunner extends Runner {
+ @Override
+ public Description getDescription() {
+ return null;
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ // do nothing
+ }
+ }
+
+ @RunWith(BadRunner.class)
+ public static class Empty {
+ }
+
+ @Test
+ public void characterizeErrorMessageFromBadRunner() {
+ assertEquals(
+ "Custom runner class BadRunner should have a public constructor with signature BadRunner(Class testClass)",
+ JUnitCore.runClasses(Empty.class).getFailures().get(0)
+ .getMessage());
+ }
}
Index: AllTests.java
===================================================================
RCS file: /cvsroot/junit/junit/src/org/junit/tests/AllTests.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- AllTests.java 21 Feb 2007 15:19:39 -0000 1.8
+++ AllTests.java 21 Feb 2007 17:12:37 -0000 1.9
@@ -6,7 +6,8 @@
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
-// TODO (Feb 21, 2007 10:05:41 AM): organize these tests
+// These test files need to be cleaned. See
+// https://sourceforge.net/pm/task.php?func=detailtask&project_task_id=136507&group_id=15278&group_project_id=51407
@RunWith(Suite.class)
@SuiteClasses({
-------------------------------------------------------------------------
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