@@ -43,13 +43,10 @@ public boolean isDisplayed() {
4343 @ Test
4444 public void testDefaultStrategy () {
4545 final FakeElement el = new FakeElement ();
46- final Wait <FakeElement > wait = new AppiumFluentWait <>(
47- el , new SystemClock (),
48- duration -> {
49- assertThat (duration .in (TimeUnit .SECONDS ), is (equalTo (1 )));
50- Thread .sleep (duration .in (TimeUnit .MILLISECONDS ));
51- }
52- ).withPollingStrategy (AppiumFluentWait .IterationInfo ::getInterval )
46+ final Wait <FakeElement > wait = new AppiumFluentWait <>(el , new SystemClock (), duration -> {
47+ assertThat (duration .in (TimeUnit .SECONDS ), is (equalTo (1 )));
48+ Thread .sleep (duration .in (TimeUnit .MILLISECONDS ));
49+ }).withPollingStrategy (AppiumFluentWait .IterationInfo ::getInterval )
5350 .withTimeout (3 , TimeUnit .SECONDS )
5451 .pollingEvery (1 , TimeUnit .SECONDS );
5552 try {
@@ -64,14 +61,11 @@ el, new SystemClock(),
6461 public void testCustomStrategyOverridesDefaultInterval () {
6562 final FakeElement el = new FakeElement ();
6663 final AtomicInteger callsCounter = new AtomicInteger (0 );
67- final Wait <FakeElement > wait = new AppiumFluentWait <>(
68- el , new SystemClock (),
69- duration -> {
70- callsCounter .incrementAndGet ();
71- assertThat (duration .in (TimeUnit .SECONDS ), is (equalTo (2 )));
72- Thread .sleep (duration .in (TimeUnit .MILLISECONDS ));
73- }
74- ).withPollingStrategy (info -> new Duration (2 , TimeUnit .SECONDS ))
64+ final Wait <FakeElement > wait = new AppiumFluentWait <>(el , new SystemClock (), duration -> {
65+ callsCounter .incrementAndGet ();
66+ assertThat (duration .in (TimeUnit .SECONDS ), is (equalTo (2 )));
67+ Thread .sleep (duration .in (TimeUnit .MILLISECONDS ));
68+ }).withPollingStrategy (info -> new Duration (2 , TimeUnit .SECONDS ))
7569 .withTimeout (3 , TimeUnit .SECONDS )
7670 .pollingEvery (1 , TimeUnit .SECONDS );
7771 try {
@@ -89,14 +83,11 @@ public void testIntervalCalculationForCustomStrategy() {
8983 final AtomicInteger callsCounter = new AtomicInteger (0 );
9084 // Linear dependency
9185 final Function <Long , Long > pollingStrategy = x -> x * 2 ;
92- final Wait <FakeElement > wait = new AppiumFluentWait <>(
93- el , new SystemClock (),
94- duration -> {
95- int callNumber = callsCounter .incrementAndGet ();
96- assertThat (duration .in (TimeUnit .SECONDS ), is (equalTo (pollingStrategy .apply ((long ) callNumber ))));
97- Thread .sleep (duration .in (TimeUnit .MILLISECONDS ));
98- }
99- ).withPollingStrategy (info -> new Duration (pollingStrategy .apply (info .getNumber ()), TimeUnit .SECONDS ))
86+ final Wait <FakeElement > wait = new AppiumFluentWait <>(el , new SystemClock (), duration -> {
87+ int callNumber = callsCounter .incrementAndGet ();
88+ assertThat (duration .in (TimeUnit .SECONDS ), is (equalTo (pollingStrategy .apply ((long ) callNumber ))));
89+ Thread .sleep (duration .in (TimeUnit .MILLISECONDS ));
90+ }).withPollingStrategy (info -> new Duration (pollingStrategy .apply (info .getNumber ()), TimeUnit .SECONDS ))
10091 .withTimeout (4 , TimeUnit .SECONDS )
10192 .pollingEvery (1 , TimeUnit .SECONDS );
10293 try {
0 commit comments