Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.0-M4
-
None
Description
Associated versions on my end at time of testing:
- JUnit Jupiter 5.3.2
- JDK 1.8u172
- Maven 3.6.3
Demonstration available at https://github.com/ajohnstonTE/surefire-jira-examples/tree/master/junit-assertions-fail
If the following JUnit 5 code is run through Surefire, then the reporting breaks for that class, resulting in no reported errors/failures from that class (though any failures will still be reported overall in the counts):
public class JUnit5Test { @Test void failWithNoParameters() { Assertions.fail(); } }
Resulting output:
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.016 s <<< FAILURE! - in JUnit5Test [ERROR] JUnit5Test.failWithNoParameters Time elapsed: 0.008 s <<< FAILURE! [ERROR] Failures: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) on project junit-assertions-fail: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test failed.: NullPointerException -> [Help 1] [ERROR] [ERROR] To see the full stack trace...
And with the -e flag, trimmed to the relevant part:
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.016 s <<< FAILURE! - in JUnit5Test [ERROR] JUnit5Test.failWithNoParameters Time elapsed: 0.007 s <<< FAILURE! [ERROR] Failures: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) on project junit-assertions-fail: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test failed.: NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) on project junit-assertions-fail: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test failed. Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test failed. Caused by: java.lang.NullPointerException at org.apache.maven.plugin.surefire.report.DefaultReporterFactory.printTestFailures (DefaultReporterFactory.java:398) at org.apache.maven.plugin.surefire.report.DefaultReporterFactory.runCompleted (DefaultReporterFactory.java:198) at org.apache.maven.plugin.surefire.report.DefaultReporterFactory.close (DefaultReporterFactory.java:171) at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run (ForkStarter.java:254) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider (AbstractSurefireMojo.java:1217) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked (AbstractSurefireMojo.java:1063) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute (AbstractSurefireMojo.java:889)
Attachments
Issue Links
- links to