[java] Formatting code, no functional changes
@@ -131,11 +131,9 @@ public void constructorStartsSessionAndPassesCapabilities() throws IOException {
RemoteWebDriver driver = new RemoteWebDriver(executor, capabilities);
verify(executor).execute(argThat(
- command -> Optional.of(command)
- .filter(cmd -> cmd.getName().equals(DriverCommand.NEW_SESSION))
- .filter(cmd -> cmd.getSessionId() == null)
- .filter(cmd -> cmd.getParameters().get("desiredCapabilities") == capabilities)
- .isPresent()
+ command -> command.getName().equals(DriverCommand.NEW_SESSION)
+ && command.getSessionId() == null
+ && command.getParameters().get("desiredCapabilities") == capabilities
));
verifyNoMoreInteractions(executor);
assertThat(driver.getSessionId()).isNotNull();
@@ -149,7 +147,8 @@ public void canHandlePlatformNameCapability() {
RemoteWebDriver driver = new RemoteWebDriver(executor, capabilities);
- assertThat(driver.getCapabilities().getPlatformName().is(Platform.MOJAVE)).isTrue();
+ assertThat(driver.getCapabilities().getPlatformName())
+ .satisfies(p -> p.is(Platform.MOJAVE));
}
@Test
@@ -160,7 +159,8 @@ public void canHandlePlatformOSSCapability() {
RemoteWebDriver driver = new RemoteWebDriver(executor, capabilities);
- assertThat(driver.getCapabilities().getPlatformName().is(Platform.MOJAVE)).isTrue();
+ assertThat(driver.getCapabilities().getPlatformName())
+ .satisfies(p -> p.is(Platform.MOJAVE));
}
@Test
@@ -171,7 +171,8 @@ public void canHandleUnknownPlatformNameAndFallsBackToUnix() {
RemoteWebDriver driver = new RemoteWebDriver(executor, capabilities);
- assertThat(driver.getCapabilities().getPlatformName().is(Platform.UNIX)).isTrue(); // fallback
+ assertThat(driver.getCapabilities().getPlatformName())
+ .satisfies(p -> p.is(Platform.UNIX)); // fallback
}
@Test
@@ -183,7 +184,8 @@ public void canHandleGetCommand() throws IOException {
verifyCommands(
executor, driver.getSessionId(),
- new CommandPayload(DriverCommand.GET, ImmutableMap.of("url", "http://some.host.com")));
+ new CommandPayload(
+ DriverCommand.GET, ImmutableMap.of("url", "http://some.host.com")));
}
@Test
@@ -501,11 +503,9 @@ public void canHandleSwitchToFrameByNameCommand() throws IOException {
verify(executor).execute(argThat(
command -> command.getName().equals(DriverCommand.FIND_ELEMENTS)));
verify(executor).execute(argThat(
- command -> Optional.of(command)
- .filter(cmd -> cmd.getName().equals(DriverCommand.SWITCH_TO_FRAME))
- .filter(cmd -> cmd.getParameters().size() == 1)
- .filter(cmd -> isWebElement(cmd.getParameters().get("id")))
- .isPresent()));
+ command -> command.getName().equals(DriverCommand.SWITCH_TO_FRAME)
+ && command.getParameters().size() == 1
+ && isWebElement(command.getParameters().get("id"))));
verifyNoMoreInteractions(executor);
}
@@ -1118,7 +1118,8 @@ public int getTimes() {
}
private void verifyCommands(CommandExecutor executor, SessionId sid, CommandPayload... commands)
- throws IOException {
+ throws IOException
+ {
InOrder inOrder = Mockito.inOrder(executor);
inOrder.verify(executor).execute(argThat(
command -> command.getName().equals(DriverCommand.NEW_SESSION)));
