RFR: 8265439: [TestBug] Enable and fix ignored unit tests in MenuItemTest [v2]
Ajit Ghaisas
aghaisas at openjdk.java.net
Tue Apr 20 05:45:49 UTC 2021
On Mon, 19 Apr 2021 17:47:14 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> modules/javafx.controls/src/test/java/test/javafx/scene/control/MenuItemTest.java line 410:
>>
>>> 408:
>>> 409: @Test(expected=NullPointerException.class)
>>> 410: public void setSpecifiedAccelerator_nullKeyCombination1() {
>>
>> Constructing KeyCodeCombination with a null KeyCode & constructing a KeyCharacterCombination with null key character results in NullPointerException as present in KeyCombinationTest.java.
>>
>> These tests were ignored with a comment on similar lines. I have enabled them and added expected NullPointerException.
>
> Where is the NPE thrown? I see that your change makes the test pass, but if it never gets to the `setAccelerator` call or the `assertEquals` statements maybe you could remove them?
You are right. We can remove these test cases.
The NPE is thrown from KeyCodeCombination and KeyCharacterCombination constructors and not from the method of MenuItem that is under test.
-------------
PR: https://git.openjdk.java.net/jfx/pull/466
More information about the openjfx-dev
mailing list