RFR: 8327748: Convert javax/swing/JFileChooser/6798062/bug6798062.java applet test to main [v2]
Alexey Ivanov
aivanov at openjdk.org
Mon Mar 11 16:32:24 UTC 2024
On Mon, 11 Mar 2024 09:53:17 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> Conversion of manual applet test to main based using PassFailJFrame manual framework
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> typo
Changes requested by aivanov (Reviewer).
test/jdk/javax/swing/JFileChooser/6798062/bug6798062.java line 1:
> 1: /*
Likely, all the catch blocks which simply print stack traces should propagate the exception or rather in addition to printing the stack trace call `PassFailJFrame.forceFail` with a corresponding message.
The `fail` method of the test should also call `PassFailJFrame.forceFail` to fail the test.
test/jdk/javax/swing/JFileChooser/6798062/bug6798062.java line 78:
> 76:
> 77: public static void main(String[] args) throws Exception {
> 78: PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
Please use the `builder` helper method instead of `new`.
test/jdk/javax/swing/JFileChooser/6798062/bug6798062.java line 86:
> 84: .build();
> 85:
> 86: SwingUtilities.invokeAndWait(() -> {
I suggest using the `testUI` method of the builder which accepts a lambda expression that returns a frame. Calling the passed method reference or lambda expression on EDT, registering the frame with `PassFailJFrame` and its positioning is handled automatically.
test/jdk/javax/swing/JFileChooser/6798062/bug6798062.java line 107:
> 105: }
> 106:
> 107: private JComponent initialize() {
I suggest creating the files in the current directory instead of `temp` or `home`. When run with jtreg, the current directory is set to `scratch` which is automatically removed by jtreg, which ensures no files are left behind if the test fails to clean them up for whatever reason.
-------------
PR Review: https://git.openjdk.org/jdk/pull/18180#pullrequestreview-1928016162
PR Review Comment: https://git.openjdk.org/jdk/pull/18180#discussion_r1519841469
PR Review Comment: https://git.openjdk.org/jdk/pull/18180#discussion_r1519857497
PR Review Comment: https://git.openjdk.org/jdk/pull/18180#discussion_r1519832650
PR Review Comment: https://git.openjdk.org/jdk/pull/18180#discussion_r1519835478
More information about the client-libs-dev
mailing list