RFR: 8354455: [TestBug] Remove JUnit Vintage Engine with JUnit 4 [v2]

Andy Goryachev angorya at openjdk.org
Mon Apr 14 22:13:47 UTC 2025


On Sat, 12 Apr 2025 00:23:07 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

>> 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](https://bugs.openjdk.org/browse/JDK-8296284) (Since you can not use JUnit4 anymore).
>> 
>> This also removes the `org.hamcrest` dependency, which is actually only used in one test where it can easily be replaced by a `Predicate` (instead of `Matcher`). I'm not convinced that we should keep that dependency for just one test.
>> 
>> ~Note: I could not get the `:swt` tests to compile/test, in order to run the tests. 
>> I need some guidance here how to instruct `Gradle` to compile this module (and if I need anything else? like swt?).~
>> 
>> ~Also, this probably needs an extra ticket in the JBS?~
>
> Marius Hanl has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix SWT Tests

a problem found in a doctored macOS test, I wonder if we'll see the same issue on windows/linux?

Tried to enable swt tests on macOS (build.gradle lines 3085, 3096), got three tests failed:


[FXCanvasScaledTest](https://github.com/openjdk/jfx/pull/classes/test.javafx.embed.swt.FXCanvasScaledTest.html). [initializationError](https://github.com/openjdk/jfx/pull/classes/test.javafx.embed.swt.FXCanvasScaledTest.html#initializationError)
[FXCanvasTest](https://github.com/openjdk/jfx/pull/classes/test.javafx.embed.swt.FXCanvasTest.html). [initializationError](https://github.com/openjdk/jfx/pull/classes/test.javafx.embed.swt.FXCanvasTest.html#initializationError)
[SWTCursorsTest](https://github.com/openjdk/jfx/pull/classes/test.javafx.embed.swt.SWTCursorsTest.html). [initializationError](https://github.com/openjdk/jfx/pull/classes/test.javafx.embed.swt.SWTCursorsTest.html#initializationError)


all in `SWTTest.beforeAll()`: 


org.eclipse.swt.SWTException: Invalid thread access
	at app//org.eclipse.swt.SWT.error(SWT.java:4918)
	at app//org.eclipse.swt.SWT.error(SWT.java:4833)
	at app//org.eclipse.swt.SWT.error(SWT.java:4804)
	at app//org.eclipse.swt.widgets.Display.error(Display.java:1209)
	at app//org.eclipse.swt.widgets.Display.createDisplay(Display.java:960)
	at app//org.eclipse.swt.widgets.Display.create(Display.java:944)
	at app//org.eclipse.swt.graphics.Device.<init>(Device.java:132)
	at app//org.eclipse.swt.widgets.Display.<init>(Display.java:798)
	at app//org.eclipse.swt.widgets.Display.<init>(Display.java:789)
	at app//org.eclipse.swt.widgets.Display.getDefault(Display.java:1543)
	at app//test.javafx.embed.swt.SWTTest.beforeAll(SWTTest.java:43)
	at java.base at 23.0.1/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base at 23.0.1/java.util.ArrayList.forEach(ArrayList.java:1597)


so probably need to wrap SWTTest:43 in `runOnSwtThread()`.

-------------

Changes requested by angorya (Reviewer).

PR Review: https://git.openjdk.org/jfx/pull/1774#pullrequestreview-2765840684
PR Comment: https://git.openjdk.org/jfx/pull/1774#issuecomment-2803159054


More information about the openjfx-dev mailing list