Skip to content

Commit d6effd2

Browse files
refactor: change method name from sleepUninterruptible to sleepInterruptibly
1 parent a42bc24 commit d6effd2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ private <V> V performIteration(Function<? super T, V> isTrue, Instant start, Ins
227227
long iterationNumber = 1;
228228
Throwable lastException;
229229

230-
sleepUninterruptible(pollDelay);
230+
sleepInterruptibly(pollDelay);
231231

232232
while (true) {
233233
try {
@@ -251,14 +251,16 @@ private <V> V performIteration(Function<? super T, V> isTrue, Instant start, Ins
251251
}
252252

253253
Duration interval = getIntervalWithPollingStrategy(start, iterationNumber);
254-
sleepUninterruptible(interval);
254+
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()).map(Supplier::get).orElseGet(() -> "waiting for " + isTrue);
261+
String message = Optional.ofNullable(getMessageSupplier())
262+
.map(Supplier::get)
263+
.orElseGet(() -> "waiting for " + isTrue);
262264

263265
String timeoutMessage = String.format(
264266
"Expected condition failed: %s (tried for %s millis with an interval of %s millis)",
@@ -282,9 +284,9 @@ private Duration getIntervalWithPollingStrategy(Instant start, long iterationNum
282284
.orElse(interval);
283285
}
284286

285-
private void sleepUninterruptible(Duration duration) {
287+
private void sleepInterruptibly(Duration duration) {
286288
try {
287-
if (!duration.isZero()) {
289+
if (!duration.isZero() && !duration.isNegative()) {
288290
getSleeper().sleep(duration);
289291
}
290292
} catch (InterruptedException e) {

0 commit comments

Comments
 (0)