@@ -43,13 +43,10 @@ public boolean isDisplayed() {
43
43
@ Test
44
44
public void testDefaultStrategy () {
45
45
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 )
53
50
.withTimeout (3 , TimeUnit .SECONDS )
54
51
.pollingEvery (1 , TimeUnit .SECONDS );
55
52
try {
@@ -64,14 +61,11 @@ el, new SystemClock(),
64
61
public void testCustomStrategyOverridesDefaultInterval () {
65
62
final FakeElement el = new FakeElement ();
66
63
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 ))
75
69
.withTimeout (3 , TimeUnit .SECONDS )
76
70
.pollingEvery (1 , TimeUnit .SECONDS );
77
71
try {
@@ -89,14 +83,11 @@ public void testIntervalCalculationForCustomStrategy() {
89
83
final AtomicInteger callsCounter = new AtomicInteger (0 );
90
84
// Linear dependency
91
85
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 ))
100
91
.withTimeout (4 , TimeUnit .SECONDS )
101
92
.pollingEvery (1 , TimeUnit .SECONDS );
102
93
try {
0 commit comments