Skip to content

Commit

Permalink
Remove unused "incrementMillis" field from TickingClock
Browse files Browse the repository at this point in the history
Signed-off-by: Alexei Barantsev <[email protected]>
  • Loading branch information
valfirst authored and barancev committed Nov 25, 2017
1 parent b039ab1 commit 6337d90
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void createMocks() {
element = mock(WebElement.class);
element2 = mock(WebElement.class);
finder = mockFinder();
clock = new TickingClock(CLOCK_INCREMENT);
clock = new TickingClock();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public void shouldNotThrowANoSuchElementExceptionWhenUsedWithAFluentWait() {
driver = mock(WebDriver.class);
when(driver.findElement(Mockito.<By>any())).thenThrow(new NoSuchElementException("because"));

TickingClock clock = new TickingClock(10);
TickingClock clock = new TickingClock();
Wait<WebDriver> wait = new WebDriverWait(driver, clock, clock, 1, 1001);

PublicPage page = new PublicPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@
import java.util.concurrent.TimeUnit;

public class TickingClock implements Clock, Sleeper {
private final long incrementMillis;
private long now = 0;

public TickingClock(long incrementMillis) {
this.incrementMillis = incrementMillis;
}

public long now() {
return now;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void shouldIncludeRemoteInfoForWrappedDriverTimeout() throws IOException
WebDriver testDriver = mock(WebDriver.class, withSettings().extraInterfaces(WrapsDriver.class));
when(((WrapsDriver) testDriver).getWrappedDriver()).thenReturn(driver);

TickingClock clock = new TickingClock(200);
TickingClock clock = new TickingClock();
WebDriverWait wait = new WebDriverWait(testDriver, clock, clock, 1, 200);

Throwable ex = catchThrowable(() -> wait.until((d) -> false));
Expand All @@ -83,7 +83,7 @@ public void shouldIncludeRemoteInfoForWrappedDriverTimeout() throws IOException

@Test
public void shouldThrowAnExceptionIfTheTimerRunsOut() {
TickingClock clock = new TickingClock(200);
TickingClock clock = new TickingClock();
WebDriverWait wait = new WebDriverWait(mockDriver, clock, clock, 1, 200);

Throwable ex = catchThrowable(() -> wait.until((d) -> false));
Expand All @@ -99,7 +99,7 @@ public void shouldSilentlyCaptureNoSuchElementExceptions() {
.thenThrow(new NoSuchElementException("foo"))
.thenReturn(mockElement);

TickingClock clock = new TickingClock(500);
TickingClock clock = new TickingClock();
Wait<WebDriver> wait = new WebDriverWait(mockDriver, clock, clock, 5, 500);
assertSame(mockElement, wait.until(condition));
}
Expand All @@ -112,7 +112,7 @@ public void shouldSilentlyCaptureNoSuchFrameExceptions() {
.thenThrow(new NoSuchFrameException("foo"))
.thenReturn(mockElement);

TickingClock clock = new TickingClock(500);
TickingClock clock = new TickingClock();
Wait<WebDriver> wait = new WebDriverWait(mockDriver, clock, clock, 5, 500);
wait.until(condition);
}
Expand All @@ -126,7 +126,7 @@ public void shouldSilentlyCaptureNoSuchWindowExceptions() {
.thenThrow(new NoSuchWindowException("foo"))
.thenReturn(mockElement);

TickingClock clock = new TickingClock(500);
TickingClock clock = new TickingClock();
Wait<WebDriver> wait = new WebDriverWait(mockDriver, clock, clock, 5, 500);
wait.until(condition);
}
Expand Down

0 comments on commit 6337d90

Please sign in to comment.