Hi Vincent,

In article <[EMAIL PROTECTED]>,
Sat, 6 Mar 2004 08:40:25 +0100,
"Vincent Massol" <[EMAIL PROTECTED]> wrote: 
vmassol> Yep, I had the same thought. Also cactus could check for the static
vmassol> keyword in testXXX. Just need to find some time. If anyone wants to
vmassol> submit a patch...

I had some time yesterday.

Appending is a patch against AbstractCactusTestCase.java, v 1.7.
I'm not sure if its feature is what you are looking for.

Also, I'm not sure why the static keyword check is needed.
Would you mind explaining a little further, please?
# better to change cactus-dev ML?

Regards,
----
Kazuhito SUGURI
mailto:[EMAIL PROTECTED]
--- framework/src/java/share/org/apache/cactus/AbstractCactusTestCase.java.orig 
2004-02-29 17:56:38.000000000 +0900
+++ framework/src/java/share/org/apache/cactus/AbstractCactusTestCase.java      
2004-03-11 19:38:33.000000000 +0900
@@ -26,6 +26,7 @@
 import org.apache.cactus.configuration.ConfigurationInitializer;
 import org.apache.cactus.internal.client.ClientTestCaseCaller;
 import org.apache.cactus.internal.server.ServerTestCaseCaller;
+import org.apache.cactus.util.JUnitVersionHelper;
 
 /**
  * Base class for all Cactus test case extensions.
@@ -120,6 +121,7 @@
      */
     public void runBare() throws Throwable
     {
+        checkTestCaseImplementation();
         runBareClient();
     }
 
@@ -211,4 +213,25 @@
             throw t;
         }
     }   
+
+    /**
+     * check if the Test to run is properly implemented or not.
+     *
+     * @exception Throwable if the Test has no TestCase name.
+     */
+    private void checkTestCaseImplementation() throws Throwable
+    {
+        Test test = getServerCaller().getWrappedTest();
+        if (test == null)
+        {
+            test = this;
+        }
+
+        if (JUnitVersionHelper.getTestCaseName(test) == null)
+        {
+            throw new Error("No test name found. The test ["
+                            + test.getClass().getName()
+                            + "] is not properly implemented.");
+        }
+    }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to