2626import org .junit .Assert ;
2727import org .junit .Test ;
2828import org .openqa .selenium .TimeoutException ;
29- import org .openqa .selenium .support .ui .SystemClock ;
3029import org .openqa .selenium .support .ui .Wait ;
3130
31+ import java .time .Clock ;
3232import java .util .concurrent .atomic .AtomicInteger ;
3333import java .util .function .Function ;
3434
@@ -43,7 +43,7 @@ public boolean isDisplayed() {
4343 @ Test (expected = TimeoutException .class )
4444 public void testDefaultStrategy () {
4545 final FakeElement el = new FakeElement ();
46- final Wait <FakeElement > wait = new AppiumFluentWait <>(el , new SystemClock (), duration -> {
46+ final Wait <FakeElement > wait = new AppiumFluentWait <>(el , Clock . systemDefaultZone (), duration -> {
4747 assertThat (duration .getSeconds (), is (equalTo (1L )));
4848 Thread .sleep (duration .toMillis ());
4949 }).withPollingStrategy (AppiumFluentWait .IterationInfo ::getInterval )
@@ -57,7 +57,7 @@ public void testDefaultStrategy() {
5757 public void testCustomStrategyOverridesDefaultInterval () {
5858 final FakeElement el = new FakeElement ();
5959 final AtomicInteger callsCounter = new AtomicInteger (0 );
60- final Wait <FakeElement > wait = new AppiumFluentWait <>(el , new SystemClock (), duration -> {
60+ final Wait <FakeElement > wait = new AppiumFluentWait <>(el , Clock . systemDefaultZone (), duration -> {
6161 callsCounter .incrementAndGet ();
6262 assertThat (duration .getSeconds (), is (equalTo (2L )));
6363 Thread .sleep (duration .toMillis ());
@@ -79,7 +79,7 @@ public void testIntervalCalculationForCustomStrategy() {
7979 final AtomicInteger callsCounter = new AtomicInteger (0 );
8080 // Linear dependency
8181 final Function <Long , Long > pollingStrategy = x -> x * 2 ;
82- final Wait <FakeElement > wait = new AppiumFluentWait <>(el , new SystemClock (), duration -> {
82+ final Wait <FakeElement > wait = new AppiumFluentWait <>(el , Clock . systemDefaultZone (), duration -> {
8383 int callNumber = callsCounter .incrementAndGet ();
8484 assertThat (duration .getSeconds (), is (equalTo (pollingStrategy .apply ((long ) callNumber ))));
8585 Thread .sleep (duration .toMillis ());
0 commit comments