RFR: 8346222: SwingNodePlatformExitCrashTest fails with JUnit 5.11.3
Kevin Rushforth
kcr at openjdk.org
Fri Dec 13 19:50:51 UTC 2024
This PR fixes a latent test bug in test bug in `SwingNodePlatformExitCrashTest` by setting a flag to skip shutdown rather than relying on a quirk of JUnit 5.8.1.
I discovered this while testing PR #1662 which updates JUnit to 5.11.3.
$ gradle sdk shims
$ 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)
...
The abstract `SwingNodeBase` base class calls `Util::shutdown` from its 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`.
-------------
Commit messages:
- 8346222: SwingNodePlatformExitCrashTest fails with JUnit 5.11.3
Changes: https://git.openjdk.org/jfx/pull/1664/files
Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1664&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8346222
Stats: 11 lines in 2 files changed: 4 ins; 1 del; 6 mod
Patch: https://git.openjdk.org/jfx/pull/1664.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1664/head:pull/1664
PR: https://git.openjdk.org/jfx/pull/1664
More information about the openjfx-dev
mailing list