Skip to content

Commit

Permalink
[java] remove guava from client bindings #12737
Browse files Browse the repository at this point in the history
  • Loading branch information
joerg1985 committed Mar 26, 2024
1 parent 907b219 commit b2f4ae5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
2 changes: 0 additions & 2 deletions java/src/org/openqa/selenium/support/ui/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("@rules_jvm_external//:defs.bzl", "artifact")
load("//java:defs.bzl", "java_library")

java_library(
Expand Down Expand Up @@ -57,6 +56,5 @@ java_library(
":clock",
"//java/src/org/openqa/selenium:core",
"//java/src/org/openqa/selenium/remote",
artifact("com.google.guava:guava"),
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.openqa.selenium.support.ui;

import com.google.common.base.Function;
import java.util.function.Function;
import org.openqa.selenium.WebDriver;

/**
Expand All @@ -31,8 +31,4 @@
*
* @param <T> The return type
*/
// NB: this originally extended Guava's Function interface since Java didn't have one. To avoid code
// such as "com.google.common.base.Function condition = ExpectedConditions.elementFound(By);"
// breaking at compile time, we continue to extend Guava's Function interface.
public interface ExpectedCondition<T>
extends Function<WebDriver, T>, java.util.function.Function<WebDriver, T> {}
public interface ExpectedCondition<T> extends Function<WebDriver, T> {}
13 changes: 6 additions & 7 deletions java/src/org/openqa/selenium/support/ui/ExpectedConditions.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

package org.openqa.selenium.support.ui;

import com.google.common.base.Joiner;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
Expand Down Expand Up @@ -1415,9 +1416,8 @@ public Boolean apply(WebDriver driver) {

@Override
public String toString() {
StringBuilder message = new StringBuilder("at least one condition to be valid: ");
Joiner.on(" || ").appendTo(message, conditions);
return message.toString();
return "at least one condition to be valid: "
+ Arrays.stream(conditions).map(Objects::toString).collect(Collectors.joining(" || "));
}
};
}
Expand Down Expand Up @@ -1452,9 +1452,8 @@ public Boolean apply(WebDriver driver) {

@Override
public String toString() {
StringBuilder message = new StringBuilder("all conditions to be valid: ");
Joiner.on(" && ").appendTo(message, conditions);
return message.toString();
return "all conditions to be valid: "
+ Arrays.stream(conditions).map(Objects::toString).collect(Collectors.joining(" && "));
}
};
}
Expand Down

0 comments on commit b2f4ae5

Please sign in to comment.