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 11531] - Use code below to get test name from any Test, not just TestCase
Date Mon, 16 Sep 2002 09:58:17 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11531>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11531

Use code below to get test name from any Test, not just TestCase

Andrew.Everitt@gbr.xerox.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |



------- Additional Comments From Andrew.Everitt@gbr.xerox.com  2002-09-16 09:58 -------
I gave it a try and it didn't work :-(. After a little investigation it turns 
out that JFunc actually creates a TestletWrapper instance under the hood. 
Unfortunately that class implements a method 'name' but not 'getName', it 
doesn't make much sense to me but thats it. I modified the code in the else 
block to look for both method signatures:
            try {
                Method getNameMethod;
                try {
                    getNameMethod = t.getClass().getMethod("getName", new Class 
[0]);
                } catch (NoSuchMethodException e) {
                    getNameMethod = t.getClass().getMethod("name", new Class 
[0]);
                }
                if (getNameMethod.getReturnType() == String.class) {
                    return (String) getNameMethod.invoke(t, new Object[0]);
                }
            } catch (Throwable e) {}

With this mod all seems to work fine.

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


Mime
View raw message