Skip to content

Commit c9b7c73

Browse files
committed
Fixing compilation error in PerformanceLoggingTest
1 parent 0530de0 commit c9b7c73

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

java/client/test/org/openqa/selenium/logging/PerformanceLoggingTest.java

+6-16
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,21 @@
2929
import static org.openqa.selenium.testing.Driver.PHANTOMJS;
3030
import static org.openqa.selenium.testing.Driver.SAFARI;
3131

32-
import com.google.common.base.Predicate;
3332
import com.google.common.collect.ImmutableList;
34-
import com.google.common.collect.Iterables;
3533

3634
import org.junit.After;
3735
import org.junit.Test;
3836
import org.openqa.selenium.By;
39-
import org.openqa.selenium.Capabilities;
37+
import org.openqa.selenium.ImmutableCapabilities;
4038
import org.openqa.selenium.WebDriver;
41-
import org.openqa.selenium.firefox.FirefoxOptions;
4239
import org.openqa.selenium.logging.profiler.EventType;
4340
import org.openqa.selenium.testing.Ignore;
4441
import org.openqa.selenium.testing.JUnit4TestBase;
4542
import org.openqa.selenium.testing.drivers.WebDriverBuilder;
4643

4744
import java.util.Arrays;
45+
import java.util.stream.Collectors;
46+
import java.util.stream.StreamSupport;
4847

4948
@Ignore(HTMLUNIT)
5049
@Ignore(IE)
@@ -118,7 +117,7 @@ public void testGetsYieldToPageLoadLogEntries() throws Exception {
118117
private void startLoggingDriver() {
119118
if (loggingDriver == null) {
120119
WebDriverBuilder builder = new WebDriverBuilder().setDesiredCapabilities(
121-
getCapabilitiesWithProfilerOn(true));
120+
new ImmutableCapabilities(ENABLE_PROFILING_CAPABILITY, true));
122121
loggingDriver = builder.get();
123122
}
124123
}
@@ -129,16 +128,7 @@ private LogEntries getProfilerEntries(WebDriver driver) {
129128

130129
private ImmutableList<LogEntry> getProfilerEntriesOfType(final LogEntries entries,
131130
final EventType eventType) {
132-
return ImmutableList.copyOf(Iterables.filter(entries, new Predicate<LogEntry>() {
133-
public boolean apply(LogEntry entry) {
134-
return entry.getMessage().contains(eventType.toString());
135-
}
136-
}));
137-
}
138-
139-
private static Capabilities getCapabilitiesWithProfilerOn(boolean enabled) {
140-
FirefoxOptions options = new FirefoxOptions();
141-
options.setCapability(ENABLE_PROFILING_CAPABILITY, enabled);
142-
return options;
131+
return ImmutableList.copyOf(StreamSupport.stream(entries.spliterator(), false).filter(
132+
entry -> entry.getMessage().contains(eventType.toString())).collect(Collectors.toList()));
143133
}
144134
}

0 commit comments

Comments
 (0)