RFR: 8351884: Refactor bug8033699.java test code [v4]
Alexey Ivanov
aivanov at openjdk.org
Fri Apr 25 20:03:52 UTC 2025
On Fri, 25 Apr 2025 19:52:06 GMT, Rajat Mahajan <rmahajan at openjdk.org> wrote:
>> Details:
>> Refactored code as requested in the Bug description.
>>
>> Tested and verified the test passes.
>
> Rajat Mahajan has updated the pull request incrementally with five additional commits since the last revision:
>
> - Update test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java
>
> Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>
> - Update test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java
>
> Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>
> - Update test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java
>
> Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>
> - Update test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java
>
> Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>
> - Update test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java
>
> Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>
Changes requested by aivanov (Reviewer).
test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java line 62:
> 60: robot = new Robot();
> 61:
> 62: // Get all installed Look and Feels
Huh, it was already there. Anyway.
test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java line 63:
> 61: robot = new Robot();
> 62: SwingUtilities.invokeAndWait(() ->
> 63: focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager());
Suggestion:
robot = new Robot();
SwingUtilities.invokeAndWait(() ->
focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager());
test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java line 120:
> 118: runTest9();
> 119: robot.delay(100);
> 120: } catch (Exception e) {
Let's make the error message more informative:
} catch (Exception e) {
Throwable cause = e.getCause();
throw new RuntimeException("Error testing LaF: " + laf.getName()
+ (cause != null ? " - " + cause.getMessage() : ""),
e);
} finally {
GitHub wouldn't allow add this as suggestion as these lines aren't modified.
This produces the following output which is more descriptive since it also includes the real error message.
Testing LaF: Metal
Radio Button Group Go To Next Component through Tab Key failed
Exception in thread "main" java.lang.RuntimeException: Error testing LaF: Metal - Focus is not on Radio Button Single as Expected
at bug8033699.testLaF(bug8033699.java:125)
at bug8033699.main(bug8033699.java:67)
Caused by: java.lang.reflect.InvocationTargetException
at …
Caused by: java.lang.RuntimeException: Focus is not on Radio Button Single as Expected
at bug8033699.lambda$runTest1$3(bug8033699.java:201)
at …
-------------
PR Review: https://git.openjdk.org/jdk/pull/24384#pullrequestreview-2795152173
PR Review Comment: https://git.openjdk.org/jdk/pull/24384#discussion_r2060808469
PR Review Comment: https://git.openjdk.org/jdk/pull/24384#discussion_r2060807687
PR Review Comment: https://git.openjdk.org/jdk/pull/24384#discussion_r2060815567
More information about the client-libs-dev
mailing list