Skip to content

Commit d360811

Browse files
committed
[java] Fixing Java 8 compatibility issues
1 parent 5e92451 commit d360811

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

java/client/test/org/openqa/selenium/ProxySettingTest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import java.util.Map;
5454

5555
import static java.nio.charset.StandardCharsets.US_ASCII;
56+
import static java.util.Collections.singletonMap;
5657
import static org.assertj.core.api.Assertions.assertThat;
5758
import static org.openqa.selenium.remote.CapabilityType.PROXY;
5859
import static org.openqa.selenium.testing.drivers.Browser.CHROME;
@@ -183,7 +184,8 @@ private Server<?> createPacfileServer(final String pacFileContents) {
183184

184185
private Server<?> createServer(HttpHandler handler) {
185186
Server<?> server = new JreServer(
186-
new BaseServerOptions(new MapConfig(Map.of("server", Map.of("port", PortProber.findFreePort())))),
187+
new BaseServerOptions(new MapConfig(
188+
singletonMap("server", singletonMap("port", PortProber.findFreePort())))),
187189
handler)
188190
.start();
189191

java/client/test/org/openqa/selenium/ReferrerTest.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import java.util.List;
4949
import java.util.Objects;
5050
import java.util.concurrent.CopyOnWriteArrayList;
51+
import java.util.stream.Collectors;
5152

5253
import static com.google.common.net.HttpHeaders.REFERER;
5354
import static java.nio.charset.StandardCharsets.US_ASCII;
@@ -106,9 +107,9 @@ public class ReferrerTest {
106107

107108
@BeforeClass
108109
public static void readContents() throws IOException {
109-
page1 = Files.readString(locate("common/src/web/proxy" + PAGE_1));
110-
page2 = Files.readString(locate("common/src/web/proxy" + PAGE_2));
111-
page3 = Files.readString(locate("common/src/web/proxy/page3.html"));
110+
page1 = new String(Files.readAllBytes(locate("common/src/web/proxy" + PAGE_1)));
111+
page2 = new String(Files.readAllBytes(locate("common/src/web/proxy" + PAGE_2)));
112+
page3 = new String(Files.readAllBytes(locate("common/src/web/proxy/page3.html")));
112113
}
113114

114115
@Before
@@ -412,7 +413,7 @@ public HttpResponse execute(HttpRequest req) throws UncheckedIOException {
412413
}
413414

414415
public List<ExpectedRequest> getRequests() {
415-
return List.copyOf(requests);
416+
return requests.stream().collect(Collectors.toList());
416417
}
417418
}
418419

java/client/test/org/openqa/selenium/environment/webserver/NettyAppServer.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151

5252
public class NettyAppServer implements AppServer {
5353

54-
private static Config sslConfig = new MapConfig(Map.of("server", Map.of("https-self-signed", true)));
54+
private static Config sslConfig = new MapConfig(
55+
singletonMap("server", singletonMap("https-self-signed", true)));
5556

5657
private final Server<?> server;
5758
private final Server<?> secure;
@@ -95,9 +96,8 @@ private NettyAppServer(Config config, HttpHandler handler) {
9596
}
9697

9798
private static Config createDefaultConfig() {
98-
return new MemoizedConfig(
99-
new MapConfig(Map.of("server", Map.of(
100-
"port", PortProber.findFreePort()))));
99+
return new MemoizedConfig(new MapConfig(
100+
singletonMap("server", singletonMap("port", PortProber.findFreePort()))));
101101
}
102102

103103
@Override

0 commit comments

Comments
 (0)