Skip to content

Commit

Permalink
[java] Deleting unnecessary parentheses, reducing noise
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Nov 11, 2019
1 parent deb5919 commit c1cb579
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public void shouldTreatDraggableAsEnumeratedButNotBoolean() {
}

private void checkEnumeratedAttribute(String name, String... values) {
asList(values).forEach((value) -> {
asList(values).forEach(value -> {
driver.get(appServer.create(new Page().withBody(
String.format("<div id=\"attr\" %s=\"%s\">", name, value))));
assertThat(driver.findElement(By.id("attr")).getAttribute(name)).isEqualTo(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void shouldIncludeRemoteInfoForWrappedDriverTimeout() throws IOException
new WebDriverWait(testDriver, Duration.ofSeconds(1), Duration.ofMillis(200), clock, clock);

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

assertThatExceptionOfType(TimeoutException.class)
.isThrownBy(() -> wait.until((d) -> false));
.isThrownBy(() -> wait.until(d -> false));
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public WebDriver get() {
try {
Class<? extends WebDriver> driverClass = Class.forName(className).asSubclass(WebDriver.class);
Constructor<? extends WebDriver> constructor = driverClass.getConstructor(Capabilities.class);
driverConstructor = (caps) -> {
driverConstructor = caps -> {
try {
return constructor.newInstance(caps);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
Expand Down
6 changes: 3 additions & 3 deletions java/server/src/org/openqa/selenium/grid/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ protected Node(Tracer tracer, UUID id, URI uri) {
matching(req -> getSessionId(req.getUri()).map(SessionId::new).map(this::isSessionOwner).orElse(false))
.to(() -> new ForwardWebDriverCommand(this)).with(new SpanDecorator(tracer, req -> "node.forward_command")),
get("/se/grid/node/owner/{sessionId}")
.to((params) -> new IsSessionOwner(this, json, new SessionId(params.get("sessionId")))).with(new SpanDecorator(tracer, req -> "node.is_session_owner")),
.to(params -> new IsSessionOwner(this, json, new SessionId(params.get("sessionId")))).with(new SpanDecorator(tracer, req -> "node.is_session_owner")),
delete("/se/grid/node/session/{sessionId}")
.to((params) -> new StopNodeSession(this, new SessionId(params.get("sessionId")))).with(new SpanDecorator(tracer, req -> "node.stop_session")),
.to(params -> new StopNodeSession(this, new SessionId(params.get("sessionId")))).with(new SpanDecorator(tracer, req -> "node.stop_session")),
get("/se/grid/node/session/{sessionId}")
.to((params) -> new GetNodeSession(this, json, new SessionId(params.get("sessionId")))).with(new SpanDecorator(tracer, req -> "node.get_session")),
.to(params -> new GetNodeSession(this, json, new SessionId(params.get("sessionId")))).with(new SpanDecorator(tracer, req -> "node.get_session")),
post("/se/grid/node/session").to(() -> new NewNodeSession(this, json)).with(new SpanDecorator(tracer, req -> "node.new_session")),
get("/se/grid/node/status")
.to(() -> req -> new HttpResponse().setContent(utf8String(json.toJson(getStatus())))).with(new SpanDecorator(tracer, req -> "node.node_status")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ public SessionMap(Tracer tracer) {
routes = combine(
post("/se/grid/session").to(() -> new AddToSessionMap(tracer, json, this)),
Route.get("/se/grid/session/{sessionId}")
.to((params) -> new GetFromSessionMap(tracer, json, this, new SessionId(params.get("sessionId")))),
.to(params -> new GetFromSessionMap(tracer, json, this, new SessionId(params.get("sessionId")))),
delete("/se/grid/session/{sessionId}")
.to((params) -> new RemoveFromSession(tracer, this, new SessionId(params.get("sessionId")))));
.to(params -> new RemoveFromSession(tracer, this, new SessionId(params.get("sessionId")))));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public Void call() {
@Override
public String toString() {
return "[" + timeouts.entrySet().stream()
.map((entry) -> String.format("%s: %s", entry.getKey(), entry.getValue()))
.map(entry -> String.format("%s: %s", entry.getKey(), entry.getValue()))
.collect(Collectors.joining(",")) + "]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ResultConfig(
this.commandName = commandName;
this.log = log;
this.sessions = sessions;
this.handlerFactory = (sessionId) -> factory.get();
this.handlerFactory = sessionId -> factory.get();
}

public ResultConfig(
Expand All @@ -82,7 +82,7 @@ public ResultConfig(
this.commandName = commandName;
this.log = log;
this.sessions = sessions;
this.handlerFactory = (sessionId) -> factory.apply(sessions);
this.handlerFactory = sessionId -> factory.apply(sessions);
}

public ResultConfig(
Expand All @@ -96,7 +96,7 @@ public ResultConfig(
this.commandName = commandName;
this.log = log;
this.sessions = sessions;
this.handlerFactory = (sessionId) -> factory.apply(sessions.get(sessionId));
this.handlerFactory = sessionId -> factory.apply(sessions.get(sessionId));
}

public Response handle(Command command) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private static ImmutableMap<String, CoreStepFactory> discover() {
selenium,
state.expand(loc),
state.expand(val),
(seen) -> {
seen -> {
Object expected = getExpectedValue(method, state.expand(loc), state.expand(val));

try {
Expand All @@ -137,7 +137,7 @@ private static ImmutableMap<String, CoreStepFactory> discover() {
selenium,
state.expand(loc),
state.expand(val),
(seen) -> {
seen -> {
Object expected = getExpectedValue(method, state.expand(loc), state.expand(val));

try {
Expand All @@ -155,7 +155,7 @@ private static ImmutableMap<String, CoreStepFactory> discover() {
selenium,
state.expand(loc),
state.expand(val),
(seen) -> {
seen -> {
Object expected = getExpectedValue(method, state.expand(loc), state.expand(val));

try {
Expand All @@ -175,7 +175,7 @@ private static ImmutableMap<String, CoreStepFactory> discover() {
selenium,
state.expand(loc),
state.expand(val),
(toStore) -> {
toStore -> {
state.store(state.expand(val), toStore);
return NextStepDecorator.IDENTITY;
}));
Expand Down Expand Up @@ -246,7 +246,7 @@ public boolean until() {
selenium,
state.expand(loc),
state.expand(val),
(seen) -> {
seen -> {
// TODO: Hard coding this is obviously bogus
selenium.waitForPageToLoad("30000");
return NextStepDecorator.IDENTITY;
Expand Down

0 comments on commit c1cb579

Please sign in to comment.