On Thu, 24 Sep 2026 10:16:29 GMT, Marius Hanl <[email protected]> wrote:
>> Christopher Schnick has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Adjust check
>
> modules/javafx.controls/src/test/java/test/javafx/scene/control/ContextMenuTest.java
> line 374:
>
>> 372:
>> 373: // Fail on internal exceptions
>> 374: ControlTestUtils.runWithExceptionHandler(() -> subMenu.show());
>
> You could also use: `assertDoesNotThrow(() -> subMenu.show());`
>
> but that will require the following setup already used in other tests:
>
>
> @BeforeEach
> public void setup() {
> Thread.currentThread().setUncaughtExceptionHandler((thread,
> throwable) -> {
> if (throwable instanceof RuntimeException) {
> throw (RuntimeException)throwable;
> } else {
>
> Thread.currentThread().getThreadGroup().uncaughtException(thread, throwable);
> }
> });
> }
>
> @AfterEach
> public void cleanup() {
> Thread.currentThread().setUncaughtExceptionHandler(null);
> }
>
>
> Personally I like that more, because `assertDoesNotThrow` shows the intention
> very clearly.
What is the issue with ControlTestUtils.runWithExceptionHandler, just the
naming? I thought that existed exactly to remove the need for that setup code
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2321#discussion_r4092505200