Skip to content

Commit

Permalink
Avoid making unnecessary function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Mykola Mokhnach committed Nov 13, 2017
1 parent 3438cc5 commit a1d8386
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static Class<? extends RemoteWebElement> getElementClass(HasSessionDetail
}
ElementMap element = Optional.ofNullable(mobileElementMap.get(String
.valueOf(hasSessionDetails.getAutomationName()).toLowerCase().trim()))
.orElse(mobileElementMap
.orElseGet(() -> mobileElementMap
.get(String.valueOf(hasSessionDetails.getPlatformName()).toLowerCase().trim()));
if (element == null) {
return RemoteWebElement.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ private By getByFromDeclaredClass(WhatIsNeeded whatIsNeeded) {

@Override protected By buildDefaultBy() {
return ofNullable(super.buildDefaultBy())
.orElse(getByFromDeclaredClass(WhatIsNeeded.DEFAULT_OR_HTML));
.orElseGet(() -> getByFromDeclaredClass(WhatIsNeeded.DEFAULT_OR_HTML));
}

@Override protected By buildMobileNativeBy() {
return ofNullable(super.buildMobileNativeBy())
.orElse(getByFromDeclaredClass(WhatIsNeeded.MOBILE_NATIVE));
.orElseGet(() -> getByFromDeclaredClass(WhatIsNeeded.MOBILE_NATIVE));
}

private enum WhatIsNeeded {
Expand Down

0 comments on commit a1d8386

Please sign in to comment.