Dan Fabulich created SUREFIRE-1041:
--------------------------------------

             Summary: JUnit47 provider: Exception in JUnit Runner can crash 
test run without visible stack trace
                 Key: SUREFIRE-1041
                 URL: https://jira.codehaus.org/browse/SUREFIRE-1041
             Project: Maven Surefire
          Issue Type: Bug
            Reporter: Dan Fabulich
         Attachments: SUREFIRE-1041.patch

Run the attached Maven project. Surefire is configured to use the JUnit47 
provider. There's one test, marked with @RunWith(BadRunner.class); the 
BadRunner class throws a NullPointerException in its "run" method.

Expected: The tests should fail with a visible stacktrace; that's what happens 
when you don't use the JUnit47 provider.

Actual: The tests fail with this unhelpful error: 
{code}
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on 
project test: Execution default-test of goal 
org.apache.maven.plugins:maven-surefire-plugin:2.16:test failed: 
java.lang.RuntimeException: null,null,null,null,null: source is null -> [Help 1]
{code}

I'm also attaching a patch that fixes this problem: SimpleReportEntry should 
not throw a NPE with a null source/name, but should instead just accept them 
and convert them to the string "null." This allows the test to fail naturally 
and render the stacktrace in the console output and in surefire reports.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to