fix: usage of Optional.orElseThrow after Map.put by artlomako · Pull Request #2145 · appium/java-client
Change list
- fix broken
KeyEvent
Types of changes
What types of changes are you proposing/introducing to Java client?
Put an x in the boxes that apply
- No changes in production code.
- Bugfix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
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.