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=29407>. 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=29407 Handle null JUnit test name more gracefully Summary: Handle null JUnit test name more gracefully Product: Ant Version: 1.6.1 Platform: All OS/Version: All Status: NEW Severity: Enhancement Priority: Other Component: Optional Tasks AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] XMLJUnitTestFormatter behaves very badly when it has to report on a JUnit test with a null name. It barfs like so: [junit] java.lang.NullPointerException [junit] at org.apache.tools.ant.util.DOMElementWriter.encode(DOMElementWriter.java:209) [junit] at org.apache.tools.ant.util.DOMElementWriter.write(DOMElementWriter.java:136) [junit] at org.apache.tools.ant.util.DOMElementWriter.write(DOMElementWriter.java:154) [junit] at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.endTestSuite(XMLJUnitResultForma tter.java:171) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.fireEndTestSuite(JUnitTestRunner.java:45 2) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:346) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:536) It may be nicer to default the test name to the string "null," like the other test runners do, since a null test name is more of an inconvenience than a real problem. I encountered this when misapplying the Parameterized Test Case pattern and running my test with Maven. I didn't notice the problem at first, because there is no problem when all the tests pass -- it's only when the result formatter needs to report on a failing/erroneous test that this behavior shows itself. Then I realized that all the test names were null. (I invoked setName() from within runTest(), rather than in the test's constructor. Silly me.) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]