Skip to content

Commit

Permalink
java: fix camel case in method name numberOfWindowsToBe
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Davison <[email protected]>
  • Loading branch information
alb-i986 authored and ddavison committed Oct 8, 2015
1 parent e4917b1 commit 55715c9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,15 @@ public String toString() {
};
}

/**
* @deprecated please use {@link #numberOfWindowsToBe(int)} instead
*/
@Deprecated
public static ExpectedCondition<Boolean> numberOfwindowsToBe(final int expectedNumberOfWindows) {
return numberOfWindowsToBe(expectedNumberOfWindows);
}

public static ExpectedCondition<Boolean> numberOfWindowsToBe(final int expectedNumberOfWindows) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
import static org.mockito.Mockito.when;
import static org.openqa.selenium.support.ui.ExpectedConditions.elementSelectionStateToBe;
import static org.openqa.selenium.support.ui.ExpectedConditions.not;
import static org.openqa.selenium.support.ui.ExpectedConditions.numberOfWindowsToBe;
import static org.openqa.selenium.support.ui.ExpectedConditions.textToBePresentInElementLocated;
import static org.openqa.selenium.support.ui.ExpectedConditions.urlContains;
import static org.openqa.selenium.support.ui.ExpectedConditions.urlMatches;
import static org.openqa.selenium.support.ui.ExpectedConditions.urlToBe;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfAllElements;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfAllElementsLocatedBy;
import static org.openqa.selenium.support.ui.ExpectedConditions.numberOfwindowsToBe;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
Expand Down Expand Up @@ -451,15 +451,15 @@ public void waitingNumberOfWindowsToBeTwoWhenThereAreTwoWindowsOpen() {
Set<String> twoWindowHandles = Sets.newHashSet("w1", "w2");
when(mockDriver.getWindowHandles()).thenReturn(twoWindowHandles);

assertTrue(wait.until(numberOfwindowsToBe(2)));
assertTrue(wait.until(numberOfWindowsToBe(2)));
}

@Test(expected = TimeoutException.class)
public void waitingNumberOfWindowsToBeTwoThrowsTimeoutExceptionWhenThereAreThreeWindowsOpen() {
Set<String> threeWindowHandles = Sets.newHashSet("w1", "w2", "w3");
when(mockDriver.getWindowHandles()).thenReturn(threeWindowHandles);

wait.until(numberOfwindowsToBe(2));
wait.until(numberOfWindowsToBe(2));

// then TimeoutException is thrown
}
Expand All @@ -468,7 +468,7 @@ public void waitingNumberOfWindowsToBeTwoThrowsTimeoutExceptionWhenThereAreThree
public void waitingNumberOfWindowsToBeThrowsTimeoutExceptionWhenGetWindowHandlesThrowsWebDriverException() {
when(mockDriver.getWindowHandles()).thenThrow(WebDriverException.class);

wait.until(numberOfwindowsToBe(2));
wait.until(numberOfWindowsToBe(2));

// then TimeoutException is thrown
}
Expand Down

0 comments on commit 55715c9

Please sign in to comment.