The update of JUnit to 5.11.3 in JDK-8345937 uncovered a latent test bug in SwingNodePlatformExitCrashTest. That test now fails with JUnit 5.11.3.
The following test consistently fails on macOS and Linux (I haven't tried it on Windows) with JUnit 5.11.3 in our CI and on my local macOS system:
$ gradle -PTEST_ONLY=true -PFULL_TEST=true -PUSE_ROBOT=true :systemTests:test --tests SwingNodePlatformExitCrashTest
...
SwingNodePlatformExitCrashTest > executionError FAILED
org.opentest4j.AssertionFailedError: Exceeded timeout limit of 10000 msec
at app//test.util.Util.runAndWait(Util.java:168)
at app//test.util.Util.runAndWait(Util.java:139)
at app//test.util.Util.shutdown(Util.java:316)
at app//test.robot.javafx.embed.swing.SwingNodeBase.teardownOnce(SwingNodeBase.java:81)
at java.base@23/java.lang.reflect.Method.invoke(Method.java:580)
at java.base@23/java.util.ArrayList.forEach(ArrayList.java:1597)
at java.base@23/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1117)
at java.base@23/java.util.ArrayList.forEach(ArrayList.java:1597)
The abstract SwingNodeBase base class calls Util::shutdown from a static tearDownOnce method, annotated with @AfterAll. The SwingNodePlatformExitCrashTest shuts down the FX toolkit as part of the test so must not call shutdown a second time. The current test logic attempts to "override" the static method in the base class with an @AfterAll annotation on a static method of the same name in the subclass. This accidentally works in JUnit 5.8 by hiding the method in the parent class, but no longer does in JUnit 5.11.
The right fix is for the subclass to set a flag such that the superclass will skip the call to Util::shutdown.
The following test consistently fails on macOS and Linux (I haven't tried it on Windows) with JUnit 5.11.3 in our CI and on my local macOS system:
$ gradle -PTEST_ONLY=true -PFULL_TEST=true -PUSE_ROBOT=true :systemTests:test --tests SwingNodePlatformExitCrashTest
...
SwingNodePlatformExitCrashTest > executionError FAILED
org.opentest4j.AssertionFailedError: Exceeded timeout limit of 10000 msec
at app//test.util.Util.runAndWait(Util.java:168)
at app//test.util.Util.runAndWait(Util.java:139)
at app//test.util.Util.shutdown(Util.java:316)
at app//test.robot.javafx.embed.swing.SwingNodeBase.teardownOnce(SwingNodeBase.java:81)
at java.base@23/java.lang.reflect.Method.invoke(Method.java:580)
at java.base@23/java.util.ArrayList.forEach(ArrayList.java:1597)
at java.base@23/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1117)
at java.base@23/java.util.ArrayList.forEach(ArrayList.java:1597)
The abstract SwingNodeBase base class calls Util::shutdown from a static tearDownOnce method, annotated with @AfterAll. The SwingNodePlatformExitCrashTest shuts down the FX toolkit as part of the test so must not call shutdown a second time. The current test logic attempts to "override" the static method in the base class with an @AfterAll annotation on a static method of the same name in the subclass. This accidentally works in JUnit 5.8 by hiding the method in the parent class, but no longer does in JUnit 5.11.
The right fix is for the subclass to set a flag such that the superclass will skip the call to Util::shutdown.
- relates to
-
JDK-8340442 Enable SwingNodePlatformExitCrashTest after JDK-8340849 is fixed
- Resolved
-
JDK-8345937 Update JUnit to 5.11.3
- Resolved
- links to
-
Commit(master) openjdk/jfx/56175f40
-
Review(master) openjdk/jfx/1664