TestListenerInvocationHandler incorrectly assumes getName()
-----------------------------------------------------------

         Key: SUREFIRE-42
         URL: http://jira.codehaus.org/browse/SUREFIRE-42
     Project: surefire
        Type: Bug

    Versions: 2.0    
    Reporter: Matthew Beermann


I'm running test cases that extend our own custom base test case. If one of the 
tests fails, Surefire itself fails:

org.apache.maven.surefire.booter.SurefireExecutionException: 
com.cerner.system.util.CalendarsTest; nested exception is 
java.lang.reflect.UndeclaredThrowableException: null; nested exception is 
org.apache.maven.surefire.testset.TestSetFailedException: 
com.cerner.system.util.CalendarsTest; nested exception is 
java.lang.reflect.UndeclaredThrowableException: null
org.apache.maven.surefire.testset.TestSetFailedException: 
com.cerner.system.util.CalendarsTest; nested exception is 
java.lang.reflect.UndeclaredThrowableException: null
java.lang.reflect.UndeclaredThrowableException
        at $Proxy0.addError(Unknown Source)
        at junit.framework.TestResult.addError(TestResult.java:36)
...
Caused by: java.lang.NoSuchMethodException: 
com.cerner.junit.madhatter.classreloader.ReloadedTestCaseDecorator.getName()
        at java.lang.Class.getMethod(Class.java:986)
        at 
org.apache.maven.surefire.junit.TestListenerInvocationHandler.getStackTraceWriter(TestListenerInvocationHandler.java:171)
        at 
org.apache.maven.surefire.junit.TestListenerInvocationHandler.handleAddError(TestListenerInvocationHandler.java:160)
        at 
org.apache.maven.surefire.junit.TestListenerInvocationHandler.invoke(TestListenerInvocationHandler.java:134)
        ... 23 more

At TestListenerInvocationHandler:171, I see that it's trying to reflect to a 
method called getName(). This seems like a very poor assumption, given that 
nothing on the Test or TestListener interfaces guarantees that there'll be a 
method called getName(). At the very least, shouldn't the NoSuchMethodException 
be caught and handled somewhere? See: 
http://www.junit.org/junit/javadoc/3.8.1/index.htm

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to