You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2002/05/12 20:26:54 UTC
cvs commit: jakarta-cactus/framework/src/java/share/org/apache/cactus/util JUnitVersionHelper.java
vmassol 02/05/12 11:26:54
Modified: framework/src/java/share/org/apache/cactus/util
JUnitVersionHelper.java
Log:
improved so that we can get test name for Test object (and not only for TestCase ones, which inherit from Test)
Revision Changes Path
1.3 +7 -7 jakarta-cactus/framework/src/java/share/org/apache/cactus/util/JUnitVersionHelper.java
Index: JUnitVersionHelper.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/util/JUnitVersionHelper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JUnitVersionHelper.java 14 Apr 2002 10:46:25 -0000 1.2
+++ JUnitVersionHelper.java 12 May 2002 18:26:54 -0000 1.3
@@ -59,6 +59,7 @@
import java.lang.reflect.Method;
import junit.framework.TestCase;
+import junit.framework.Test;
/**
* Work around for some changes to the public JUnit API between
@@ -67,7 +68,7 @@
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*
- * @version $Id: JUnitVersionHelper.java,v 1.2 2002/04/14 10:46:25 vmassol Exp $
+ * @version $Id: JUnitVersionHelper.java,v 1.3 2002/05/12 18:26:54 vmassol Exp $
*/
public class JUnitVersionHelper
{
@@ -96,16 +97,15 @@
* access to the name of a TestCase via reflection that is
* supposed to work with version before and after JUnit 3.7.
*
- * @param theTestCase the test case for which to retrieve the name
+ * @param theTest the test case for which to retrieve the name
* @return the test case name
*/
- public static String getTestCaseName(TestCase theTestCase)
+ public static String getTestCaseName(Test theTest)
{
- if (testCaseName != null) {
+ if (theTest instanceof TestCase && testCaseName != null) {
try {
- return (String) testCaseName.invoke(theTestCase, new Object[0]);
- } catch (Throwable e) {
- }
+ return (String) testCaseName.invoke(theTest, new Object[0]);
+ } catch (Throwable e) {}
}
return "unknown";
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>