8354455: [TestBug] Remove JUnit Vintage Engine with JUnit 4#1774
8354455: [TestBug] Remove JUnit Vintage Engine with JUnit 4#1774Maran23 wants to merge 3 commits into
Conversation
|
👋 Welcome back mhanl! A progress list of the required criteria for merging this PR into |
|
@Maran23 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 2 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
|
@Maran23 We don't integrate code using the JBS ID of an umbrella tasks. If there is a need for a follow-on, For this specific case, this PR may be premature. We have closed tests that still use JUnit 4, and this might break our build. I'll check next week. /reviewers 2 reviewers |
|
@kevinrushforth |
To be more precise, it's the changes in |
| import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
|
||
| @Rule | ||
| public SwtRule ctx = new SwtRule(); |
There was a problem hiding this comment.
this looks like a breaking change - what would be the junit5 equivalent of @Rule?
There was a problem hiding this comment.
@ExtendWith, but I think there is no equivalent of a method rule. In any case, another SWT test seems to be just fine without it, so I adapted the pattern to all other tests. We need to check if that works though.
There was a problem hiding this comment.
So this was interesting, turns out it wasn't that stable after all even before!
With some adjustments to the Gradle file, I could make the tests compile and run and they are now green.
The build downloads the needed SWT libraries into
Yes. Please file one and link it in JBS as "Blocks" JDK-8339170 |
I thought so, will do! |
A quick initial test suggests that this will not be a problem after all. We do not use the gradle-downloaded JUnit 4 jar files in our closed tests. I will need to do a full test run next week to confirm this, but so far this looks OK. |
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
The test run was successful on my macOS 15.4 running this command:
(git reflog -1; gradle --continue -PFULL_TEST=true -PUSE_ROBOT=true -PSWT_TEST=true cleanTest test --no-daemon -x :web:test --info 2>&1) | tee ~/`date +"test-%Y-%m%d-%H%M%S"`.log
| import static org.junit.Assume.assumeFalse; | ||
| import static org.junit.jupiter.api.Assertions.fail; | ||
| import static org.junit.jupiter.api.Assumptions.assumeFalse; | ||
|
|
There was a problem hiding this comment.
oops, my mistake! thanks for correcting it.
| display = Display.getDefault(); | ||
| } | ||
|
|
||
| protected final void runOnSwtThread(Runnable runnable) throws Throwable { |
There was a problem hiding this comment.
I like this solution - does not depend on whimsy of junit.
|
... however, my test run is not indicative because of this: we probably need to enable the SWT tests on mac because the issue seems to have been resolved in 2021: |
|
Tried to enable swt tests on macOS (build.gradle lines 3085, 3096), got three tests failed: all in so probably need to wrap SWTTest:43 in |
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
a problem found in a doctored macOS test, I wonder if we'll see the same issue on windows/linux?
The SWT tests have never worked on macOS as far as I know -- even before JDK 9 modularization when they were disabled on all platforms. Getting these tests to run on macOS seems better for a follow-up. |
Quite right. The exception I see might indicate a problem even there - the exception is coming from I'll do another run on the windows platform tomorrow. |
|
Re-tested on windows, using the same command: I don't see swt tests being run, here is relevant grep: what am I doing wrong? |
Yeah I saw this as well and looked it up, may worth to do as follow-up, as Kevin already suggested.
Weird. I just rechecked and they run for me. On Windows 11, command:
I also could not make it work, so I just modified the |
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
Re-ran the tests on windows:
- enable swt in build.gradle:3085
- using command
gradlew :swt:test -PSWT_TEST=true
all three swt tests pass.
I did the same, and all three pass for me, too. Btw, there is already a follow-up bug to re-enable the SWT tests, JDK-8169285, and it seems that we might be ready to do that after this PR is integrated. Depending on how hard it is to get the tests running on macOS, we might want a separate follow-up for that. |
kevinrushforth
left a comment
There was a problem hiding this comment.
The changes look good. I note that there is a missing comma in the copyright line of the newly added file. I'll reapprove once you correct this.
All my testing is green, including closed tests.
| @@ -0,0 +1,72 @@ | |||
| /* | |||
| * Copyright (c) 2025 Oracle and/or its affiliates. All rights reserved. | |||
There was a problem hiding this comment.
You need a comma after 2025
|
One option for JDK-8169285 would be to enable it -- optionally on the |
I think this is a good idea! I can check it out, but will do after this PR. |
kevinrushforth
left a comment
There was a problem hiding this comment.
Looks good. Since the change to add the missing comma is trivial, a single re-review is sufficient.
/reviewers 1
|
@kevinrushforth |
|
/integrate |
|
Going to push as commit 367a170.
Your commit was automatically rebased without conflicts. |

These are the remaining bits and pieces in order to completely remove the JUnit Vintage Engine, and therefore JUnit 4 from JavaFX.
After that, we should either document, that JUnit5 is used (just as information) or close JDK-8296284 (Since you can not use JUnit4 anymore).
This also removes the
org.hamcrestdependency, which is actually only used in one test where it can easily be replaced by aPredicate(instead ofMatcher). I'm not convinced that we should keep that dependency for just one test.Note: I could not get the:swttests to compile/test, in order to run the tests.I need some guidance here how to instruct
Gradleto compile this module (and if I need anything else? like swt?).Also, this probably needs an extra ticket in the JBS?Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1774/head:pull/1774$ git checkout pull/1774Update a local copy of the PR:
$ git checkout pull/1774$ git pull https://git.openjdk.org/jfx.git pull/1774/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1774View PR using the GUI difftool:
$ git pr show -t 1774Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1774.diff
Using Webrev
Link to Webrev Comment