bodewig 2002/09/13 03:13:41
Modified: . Tag: ANT_15_BRANCH WHATSNEW
src/main/org/apache/tools/ant/taskdefs/optional/junit Tag:
ANT_15_BRANCH JUnitVersionHelper.java
Added: src/testcases/org/apache/tools/ant/taskdefs/optional/junit
Tag: ANT_15_BRANCH JUnitVersionHelperTest.java
Log:
Merge testcase name discovery from HEAD
Revision Changes Path
No revision
No revision
1.263.2.77 +4 -0 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.263.2.76
retrieving revision 1.263.2.77
diff -u -r1.263.2.76 -r1.263.2.77
--- WHATSNEW 2 Sep 2002 15:14:37 -0000 1.263.2.76
+++ WHATSNEW 13 Sep 2002 10:13:40 -0000 1.263.2.77
@@ -10,6 +10,10 @@
fileset to be constructed without having to specify its parent
directory separately.
+* <junit> will now return the result of a call to getName instead of
+ "unknown" for Test implementations that don't extend TestCase but have
+ a public String getName() method.
+
Changes from Ant 1.5 to 1.5.1Beta1
==================================
No revision
No revision
1.2.2.1 +14 -2
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java
Index: JUnitVersionHelper.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- JUnitVersionHelper.java 15 Nov 2001 08:47:49 -0000 1.2
+++ JUnitVersionHelper.java 13 Sep 2002 10:13:40 -0000 1.2.2.1
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -85,11 +85,23 @@
* of JUnit remove the old name() method. This method provides
* access to the name of a TestCase via reflection that is
* supposed to work with version before and after JUnit 3.7.
+ *
+ * <p>since Ant 1.5.1 this method will invoke "<code>public
+ * String getName()</code>" on any implementation of Test if
+ * it exists.</p>
*/
public static String getTestCaseName(Test t) {
if (t instanceof TestCase && testCaseName != null) {
try {
return (String) testCaseName.invoke(t, new Object[0]);
+ } catch (Throwable e) {}
+ } else {
+ try {
+ Method getNameMethod =
+ t.getClass().getMethod("getName", new Class [0]);
+ if (getNameMethod.getReturnType() == String.class) {
+ return (String) getNameMethod.invoke(t, new Object[0]);
+ }
} catch (Throwable e) {}
}
return "unknown";
No revision
No revision
1.1.2.1 +0 -0
jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java
Index: JUnitVersionHelperTest.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>