Skip to content

Commit

Permalink
refactor: amend message generation in AppiumFluentWait
Browse files Browse the repository at this point in the history
Co-authored-by: Valery Yatsynovich <[email protected]>
  • Loading branch information
AlessandroMiccoli and valfirst authored Feb 15, 2024
1 parent 6e47723 commit a42bc24
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/io/appium/java_client/AppiumFluentWait.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,11 @@ private <V> V performIteration(Function<? super T, V> isTrue, Instant start, Ins
}

private <V> void handleTimeoutException(Throwable lastException, Function<? super T, V> isTrue) {
String message = getMessageSupplier() != null ? getMessageSupplier().get() : null;
String waitingMessage = message != null ? message : "waiting for " + isTrue;
String message = Optional.ofNullable(getMessageSupplier()).map(Supplier::get).orElseGet(() -> "waiting for " + isTrue);

String timeoutMessage = String.format(
"Expected condition failed: %s (tried for %s millis with an interval of %s millis)",
waitingMessage,
message,
getTimeout().toMillis(),
getInterval().toMillis()
);
Expand Down

0 comments on commit a42bc24

Please sign in to comment.