Skip to content

Commit 928ec44

Browse files
refactor: amend type to var in AppiumFluentWait
1 parent d6effd2 commit 928ec44

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,15 @@ public AppiumFluentWait<T> withPollingStrategy(Function<IterationInfo, Duration>
216216
*/
217217
@Override
218218
public <V> V until(Function<? super T, V> isTrue) {
219-
final Instant start = getClock().instant();
219+
final var start = getClock().instant();
220220
// Adding pollDelay to end instant will allow to verify the condition for the expected timeout duration.
221-
final Instant end = start.plus(getTimeout()).plus(pollDelay);
221+
final var end = start.plus(getTimeout()).plus(pollDelay);
222222

223223
return performIteration(isTrue, start, end);
224224
}
225225

226226
private <V> V performIteration(Function<? super T, V> isTrue, Instant start, Instant end) {
227-
long iterationNumber = 1;
227+
var iterationNumber = 1;
228228
Throwable lastException;
229229

230230
sleepInterruptibly(pollDelay);
@@ -250,19 +250,19 @@ private <V> V performIteration(Function<? super T, V> isTrue, Instant start, Ins
250250
handleTimeoutException(lastException, isTrue);
251251
}
252252

253-
Duration interval = getIntervalWithPollingStrategy(start, iterationNumber);
253+
var interval = getIntervalWithPollingStrategy(start, iterationNumber);
254254
sleepInterruptibly(interval);
255255

256256
++iterationNumber;
257257
}
258258
}
259259

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

265-
String timeoutMessage = String.format(
265+
var timeoutMessage = String.format(
266266
"Expected condition failed: %s (tried for %s millis with an interval of %s millis)",
267267
message,
268268
getTimeout().toMillis(),
@@ -273,10 +273,10 @@ private <V> void handleTimeoutException(Throwable lastException, Function<? supe
273273
}
274274

275275
private Duration getIntervalWithPollingStrategy(Instant start, long iterationNumber) {
276-
Duration interval = getInterval();
276+
var interval = getInterval();
277277
return Optional.ofNullable(pollingStrategy)
278278
.map(strategy -> {
279-
final IterationInfo info = new IterationInfo(
279+
final var info = new IterationInfo(
280280
iterationNumber,
281281
Duration.between(start, getClock().instant()), getTimeout(), interval);
282282
return strategy.apply(info);

0 commit comments

Comments
 (0)