Skip to content

Commit c1cb579

Browse files
committed
[java] Deleting unnecessary parentheses, reducing noise
1 parent deb5919 commit c1cb579

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public void shouldTreatDraggableAsEnumeratedButNotBoolean() {
427427
}
428428

429429
private void checkEnumeratedAttribute(String name, String... values) {
430-
asList(values).forEach((value) -> {
430+
asList(values).forEach(value -> {
431431
driver.get(appServer.create(new Page().withBody(
432432
String.format("<div id=\"attr\" %s=\"%s\">", name, value))));
433433
assertThat(driver.findElement(By.id("attr")).getAttribute(name)).isEqualTo(value);

java/client/test/org/openqa/selenium/support/ui/WebDriverWaitTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void shouldIncludeRemoteInfoForWrappedDriverTimeout() throws IOException
7373
new WebDriverWait(testDriver, Duration.ofSeconds(1), Duration.ofMillis(200), clock, clock);
7474

7575
assertThatExceptionOfType(TimeoutException.class)
76-
.isThrownBy(() -> wait.until((d) -> false))
76+
.isThrownBy(() -> wait.until(d -> false))
7777
.withMessageContaining("Capabilities {javascriptEnabled: true, platform: ANY, platformName: ANY}")
7878
.withMessageContaining("Session ID: foo");
7979
}
@@ -85,7 +85,7 @@ public void shouldThrowAnExceptionIfTheTimerRunsOut() {
8585
new WebDriverWait(mockDriver, Duration.ofSeconds(1), Duration.ofMillis(200), clock, clock);
8686

8787
assertThatExceptionOfType(TimeoutException.class)
88-
.isThrownBy(() -> wait.until((d) -> false));
88+
.isThrownBy(() -> wait.until(d -> false));
8989
}
9090

9191
@SuppressWarnings("unchecked")

java/client/test/org/openqa/selenium/testing/drivers/DefaultDriverSupplier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public WebDriver get() {
6767
try {
6868
Class<? extends WebDriver> driverClass = Class.forName(className).asSubclass(WebDriver.class);
6969
Constructor<? extends WebDriver> constructor = driverClass.getConstructor(Capabilities.class);
70-
driverConstructor = (caps) -> {
70+
driverConstructor = caps -> {
7171
try {
7272
return constructor.newInstance(caps);
7373
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {

java/server/src/org/openqa/selenium/grid/node/Node.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ protected Node(Tracer tracer, UUID id, URI uri) {
113113
matching(req -> getSessionId(req.getUri()).map(SessionId::new).map(this::isSessionOwner).orElse(false))
114114
.to(() -> new ForwardWebDriverCommand(this)).with(new SpanDecorator(tracer, req -> "node.forward_command")),
115115
get("/se/grid/node/owner/{sessionId}")
116-
.to((params) -> new IsSessionOwner(this, json, new SessionId(params.get("sessionId")))).with(new SpanDecorator(tracer, req -> "node.is_session_owner")),
116+
.to(params -> new IsSessionOwner(this, json, new SessionId(params.get("sessionId")))).with(new SpanDecorator(tracer, req -> "node.is_session_owner")),
117117
delete("/se/grid/node/session/{sessionId}")
118-
.to((params) -> new StopNodeSession(this, new SessionId(params.get("sessionId")))).with(new SpanDecorator(tracer, req -> "node.stop_session")),
118+
.to(params -> new StopNodeSession(this, new SessionId(params.get("sessionId")))).with(new SpanDecorator(tracer, req -> "node.stop_session")),
119119
get("/se/grid/node/session/{sessionId}")
120-
.to((params) -> new GetNodeSession(this, json, new SessionId(params.get("sessionId")))).with(new SpanDecorator(tracer, req -> "node.get_session")),
120+
.to(params -> new GetNodeSession(this, json, new SessionId(params.get("sessionId")))).with(new SpanDecorator(tracer, req -> "node.get_session")),
121121
post("/se/grid/node/session").to(() -> new NewNodeSession(this, json)).with(new SpanDecorator(tracer, req -> "node.new_session")),
122122
get("/se/grid/node/status")
123123
.to(() -> req -> new HttpResponse().setContent(utf8String(json.toJson(getStatus())))).with(new SpanDecorator(tracer, req -> "node.node_status")),

java/server/src/org/openqa/selenium/grid/sessionmap/SessionMap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ public SessionMap(Tracer tracer) {
8686
routes = combine(
8787
post("/se/grid/session").to(() -> new AddToSessionMap(tracer, json, this)),
8888
Route.get("/se/grid/session/{sessionId}")
89-
.to((params) -> new GetFromSessionMap(tracer, json, this, new SessionId(params.get("sessionId")))),
89+
.to(params -> new GetFromSessionMap(tracer, json, this, new SessionId(params.get("sessionId")))),
9090
delete("/se/grid/session/{sessionId}")
91-
.to((params) -> new RemoveFromSession(tracer, this, new SessionId(params.get("sessionId")))));
91+
.to(params -> new RemoveFromSession(tracer, this, new SessionId(params.get("sessionId")))));
9292
}
9393

9494
@Override

java/server/src/org/openqa/selenium/remote/server/handler/ConfigureTimeout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public Void call() {
9898
@Override
9999
public String toString() {
100100
return "[" + timeouts.entrySet().stream()
101-
.map((entry) -> String.format("%s: %s", entry.getKey(), entry.getValue()))
101+
.map(entry -> String.format("%s: %s", entry.getKey(), entry.getValue()))
102102
.collect(Collectors.joining(",")) + "]";
103103
}
104104
}

java/server/src/org/openqa/selenium/remote/server/rest/ResultConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public ResultConfig(
6868
this.commandName = commandName;
6969
this.log = log;
7070
this.sessions = sessions;
71-
this.handlerFactory = (sessionId) -> factory.get();
71+
this.handlerFactory = sessionId -> factory.get();
7272
}
7373

7474
public ResultConfig(
@@ -82,7 +82,7 @@ public ResultConfig(
8282
this.commandName = commandName;
8383
this.log = log;
8484
this.sessions = sessions;
85-
this.handlerFactory = (sessionId) -> factory.apply(sessions);
85+
this.handlerFactory = sessionId -> factory.apply(sessions);
8686
}
8787

8888
public ResultConfig(
@@ -96,7 +96,7 @@ public ResultConfig(
9696
this.commandName = commandName;
9797
this.log = log;
9898
this.sessions = sessions;
99-
this.handlerFactory = (sessionId) -> factory.apply(sessions.get(sessionId));
99+
this.handlerFactory = sessionId -> factory.apply(sessions.get(sessionId));
100100
}
101101

102102
public Response handle(Command command) {

java/server/src/org/openqa/selenium/server/htmlrunner/ReflectivelyDiscoveredSteps.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private static ImmutableMap<String, CoreStepFactory> discover() {
119119
selenium,
120120
state.expand(loc),
121121
state.expand(val),
122-
(seen) -> {
122+
seen -> {
123123
Object expected = getExpectedValue(method, state.expand(loc), state.expand(val));
124124

125125
try {
@@ -137,7 +137,7 @@ private static ImmutableMap<String, CoreStepFactory> discover() {
137137
selenium,
138138
state.expand(loc),
139139
state.expand(val),
140-
(seen) -> {
140+
seen -> {
141141
Object expected = getExpectedValue(method, state.expand(loc), state.expand(val));
142142

143143
try {
@@ -155,7 +155,7 @@ private static ImmutableMap<String, CoreStepFactory> discover() {
155155
selenium,
156156
state.expand(loc),
157157
state.expand(val),
158-
(seen) -> {
158+
seen -> {
159159
Object expected = getExpectedValue(method, state.expand(loc), state.expand(val));
160160

161161
try {
@@ -175,7 +175,7 @@ private static ImmutableMap<String, CoreStepFactory> discover() {
175175
selenium,
176176
state.expand(loc),
177177
state.expand(val),
178-
(toStore) -> {
178+
toStore -> {
179179
state.store(state.expand(val), toStore);
180180
return NextStepDecorator.IDENTITY;
181181
}));
@@ -246,7 +246,7 @@ public boolean until() {
246246
selenium,
247247
state.expand(loc),
248248
state.expand(val),
249-
(seen) -> {
249+
seen -> {
250250
// TODO: Hard coding this is obviously bogus
251251
selenium.waitForPageToLoad("30000");
252252
return NextStepDecorator.IDENTITY;

0 commit comments

Comments
 (0)