Skip to content

Commit a42bc24

Browse files
refactor: amend message generation in AppiumFluentWait
Co-authored-by: Valery Yatsynovich <[email protected]>
1 parent 6e47723 commit a42bc24

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/java/io/appium/java_client/AppiumFluentWait.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,11 @@ private <V> V performIteration(Function<? super T, V> isTrue, Instant start, Ins
258258
}
259259

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

264263
String timeoutMessage = String.format(
265264
"Expected condition failed: %s (tried for %s millis with an interval of %s millis)",
266-
waitingMessage,
265+
message,
267266
getTimeout().toMillis(),
268267
getInterval().toMillis()
269268
);

0 commit comments

Comments
 (0)