ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 40289] New: - The JUnit optional task does not support JUnit 4.1 (JDK 1.5)
Date Fri, 18 Aug 2006 22:04:49 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40289>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40289

           Summary: The JUnit optional task does not support JUnit 4.1 (JDK
                    1.5)
           Product: Ant
           Version: 1.6.5
          Platform: All
        OS/Version: other
            Status: NEW
          Keywords: JDK1.5
          Severity: normal
          Priority: P2
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: sonya_quist@yahoo.com


JUnit task (JUnitVersionHelper.java) does not support new annotated test cased 
support in JUnit 4.1.

Here is the corrected code:
    public static String getTestCaseName(Test t) {
        if (t instanceof TestCase && testCaseName != null) {
            try {
                return (String) testCaseName.invoke(t, new Object[0]);
            } catch (Throwable e) {
                // ignore
            }
        } else {
            try {
                Method getNameMethod = null;
                try {
                    getNameMethod =
                        t.getClass().getMethod("getName", new Class [0]);
                } catch (NoSuchMethodException e) {
                	try {
                	    getNameMethod = t.getClass().getMethod("name",
                	                                           new Class 
[0]);
	                } catch (NoSuchMethodException e2) {
										
	// support Junit 4.1
                	    getNameMethod = t.getClass().getMethod("toString",
                	                                           new Class 
[0]);
									}
                }
                if (getNameMethod != null
                    && getNameMethod.getReturnType() == String.class) {
                    return (String) getNameMethod.invoke(t, new Object[0]);
                }
            } catch (Throwable e) {
                // ignore
            }
        }
        return "unknown";
    }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message