appium / java-client

Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol
Apache License 2.0
1.19k stars 752 forks source link

fix: usage of Optional.orElseThrow after Map.put #2145

Closed artlomako closed 3 months ago

artlomako commented 3 months ago

Change list

Types of changes

What types of changes are you proposing/introducing to Java client? Put an x in the boxes that apply

Details

After the last change in KeyEvent class, it's impossible to use the key event, because the following code always throws an exception:

  ofNullable(this.keyCode)
                    .map(x -> map.put("keycode", x))
                    .orElseThrow(() -> new IllegalStateException("The key code must be set"));

since map.put() returns null for new key.

linux-foundation-easycla[bot] commented 3 months ago

CLA Signed

The committers listed above are authorized under a signed CLA.

valfirst commented 3 months ago

@artlomako checkstyle is failed