Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
Patch
Description
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:
[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]
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.