Skip to content

Commit 4a879c7

Browse files
committed
[java] Fixing use of deprecated API in tests
1 parent c867ec3 commit 4a879c7

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

java/client/test/org/openqa/selenium/remote/RemoteWebDriverUnitTest.java

+7-9
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@
5858
import java.io.UncheckedIOException;
5959
import java.lang.reflect.Array;
6060
import java.net.URL;
61+
import java.time.Duration;
6162
import java.util.Arrays;
6263
import java.util.Collections;
6364
import java.util.List;
6465
import java.util.Map;
6566
import java.util.Optional;
6667
import java.util.Set;
6768
import java.util.UUID;
68-
import java.util.concurrent.TimeUnit;
6969
import java.util.function.Function;
7070
import java.util.logging.Level;
7171
import java.util.stream.Collectors;
@@ -858,7 +858,7 @@ public void canHandleSetImplicitWaitCommand() throws IOException {
858858
CommandExecutor executor = prepareExecutorMock(echoCapabilities, nullValueResponder);
859859

860860
RemoteWebDriver driver = new RemoteWebDriver(executor, new ImmutableCapabilities());
861-
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
861+
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
862862

863863
verifyCommands(
864864
executor, driver.getSessionId(),
@@ -870,7 +870,7 @@ public void canHandleSetScriptTimeoutCommand() throws IOException {
870870
CommandExecutor executor = prepareExecutorMock(echoCapabilities, nullValueResponder);
871871

872872
RemoteWebDriver driver = new RemoteWebDriver(executor, new ImmutableCapabilities());
873-
driver.manage().timeouts().setScriptTimeout(10, TimeUnit.SECONDS);
873+
driver.manage().timeouts().setScriptTimeout(Duration.ofSeconds(10));
874874

875875
verifyCommands(
876876
executor, driver.getSessionId(),
@@ -882,7 +882,7 @@ public void canHandleSetPageLoadTimeoutCommand() throws IOException {
882882
CommandExecutor executor = prepareExecutorMock(echoCapabilities, nullValueResponder);
883883

884884
RemoteWebDriver driver = new RemoteWebDriver(executor, new ImmutableCapabilities());
885-
driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
885+
driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(10));
886886

887887
verifyCommands(
888888
executor, driver.getSessionId(),
@@ -1211,8 +1211,8 @@ public void canHandleElementCssPropertyCommand() throws IOException {
12111211
ImmutableMap.of("id", element.getId(), "propertyName", "color")));
12121212
}
12131213

1214-
private class MultiCommandPayload extends CommandPayload {
1215-
private int times;
1214+
private static class MultiCommandPayload extends CommandPayload {
1215+
private final int times;
12161216

12171217
MultiCommandPayload(int times, String name, Map<String, ?> parameters) {
12181218
super(name, parameters);
@@ -1283,9 +1283,7 @@ private boolean isWebElement(Object value) {
12831283
.isPresent();
12841284
}
12851285

1286-
private final Function<Command, Response> nullResponder = cmd -> {
1287-
return null;
1288-
};
1286+
private final Function<Command, Response> nullResponder = cmd -> null;
12891287

12901288
private final Function<Command, Response> exceptionResponder = cmd -> {
12911289
throw new InternalError("BOOM!!!");

0 commit comments

Comments
 (0)