RFR: 8280948: [TESTBUG] Write a regression test for JDK-4659800 [v4]

Alexey Ivanov aivanov at openjdk.java.net
Fri Feb 4 10:53:14 UTC 2022


On Fri, 4 Feb 2022 10:30:52 GMT, Manukumar V S <mvs at openjdk.org> wrote:

>> Write a regression test for JDK-4659800.
>> This test checks whether typing 'Enter' key generates ActionEvent on focused Button or not, in Windows and Windows Classic Look And Feels in Windows platform.
>> This test is run 10 times on windows and it passed all the times.
>
> Manukumar V S has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fixed review comments - Filtered out Windows LnFs,removed JTextField,updated Summary

test/jdk/javax/swing/JButton/4659800/EnterKeyActivatesButton.java line 92:

> 90:         Robot robot = new Robot();
> 91:         robot.setAutoDelay(100);
> 92:         //Filter out Windows related LnFs.

The comment is misleading: Filter out non-Windows L&Fs.

Usually, there's a space after `//`.

test/jdk/javax/swing/JButton/4659800/EnterKeyActivatesButton.java line 96:

> 94:                 .filter(laf -> laf.getName().startsWith("Windows"))
> 95:                 .map(laf -> laf.getClassName())
> 96:                 .collect(Collectors.toList());

Just a note. You can align the chained calls with the first `.stream` one. Here, it nearly fits into 80-column limit and doesn't exceed 100-column limit. I don't know if there are any guidelines in this regard for java.desktop module. It's up to you.

IDE recommends replacing `.collect(Collectors.toList()` with `.toList()` — looks cleaner, doesn't it?

It also recommends replacing lambda expression `laf -> laf.getClassName()` with method reference `UIManager.LookAndFeelInfo::getClassName`, yet the former seems to convey the intent clearer.

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

PR: https://git.openjdk.java.net/jdk/pull/7296



More information about the client-libs-dev mailing list