Skip to content

Commit

Permalink
Fix check style issues for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mykola Mokhnach committed Mar 30, 2017
1 parent df2cd19 commit f2d377b
Showing 1 changed file with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,10 @@ public boolean isDisplayed() {
@Test
public void testDefaultStrategy() {
final FakeElement el = new FakeElement();
final Wait<FakeElement> wait = new AppiumFluentWait<>(
el, new SystemClock(),
duration -> {
assertThat(duration.in(TimeUnit.SECONDS), is(equalTo(1)));
Thread.sleep(duration.in(TimeUnit.MILLISECONDS));
}
).withPollingStrategy(AppiumFluentWait.IterationInfo::getInterval)
final Wait<FakeElement> wait = new AppiumFluentWait<>(el, new SystemClock(), duration -> {
assertThat(duration.in(TimeUnit.SECONDS), is(equalTo(1)));
Thread.sleep(duration.in(TimeUnit.MILLISECONDS));
}).withPollingStrategy(AppiumFluentWait.IterationInfo::getInterval)
.withTimeout(3, TimeUnit.SECONDS)
.pollingEvery(1, TimeUnit.SECONDS);
try {
Expand All @@ -64,14 +61,11 @@ el, new SystemClock(),
public void testCustomStrategyOverridesDefaultInterval() {
final FakeElement el = new FakeElement();
final AtomicInteger callsCounter = new AtomicInteger(0);
final Wait<FakeElement> wait = new AppiumFluentWait<>(
el, new SystemClock(),
duration -> {
callsCounter.incrementAndGet();
assertThat(duration.in(TimeUnit.SECONDS), is(equalTo(2)));
Thread.sleep(duration.in(TimeUnit.MILLISECONDS));
}
).withPollingStrategy(info -> new Duration(2, TimeUnit.SECONDS))
final Wait<FakeElement> wait = new AppiumFluentWait<>(el, new SystemClock(), duration -> {
callsCounter.incrementAndGet();
assertThat(duration.in(TimeUnit.SECONDS), is(equalTo(2)));
Thread.sleep(duration.in(TimeUnit.MILLISECONDS));
}).withPollingStrategy(info -> new Duration(2, TimeUnit.SECONDS))
.withTimeout(3, TimeUnit.SECONDS)
.pollingEvery(1, TimeUnit.SECONDS);
try {
Expand All @@ -89,14 +83,11 @@ public void testIntervalCalculationForCustomStrategy() {
final AtomicInteger callsCounter = new AtomicInteger(0);
// Linear dependency
final Function<Long, Long> pollingStrategy = x -> x * 2;
final Wait<FakeElement> wait = new AppiumFluentWait<>(
el, new SystemClock(),
duration -> {
int callNumber = callsCounter.incrementAndGet();
assertThat(duration.in(TimeUnit.SECONDS), is(equalTo(pollingStrategy.apply((long) callNumber))));
Thread.sleep(duration.in(TimeUnit.MILLISECONDS));
}
).withPollingStrategy(info -> new Duration(pollingStrategy.apply(info.getNumber()), TimeUnit.SECONDS))
final Wait<FakeElement> wait = new AppiumFluentWait<>(el, new SystemClock(), duration -> {
int callNumber = callsCounter.incrementAndGet();
assertThat(duration.in(TimeUnit.SECONDS), is(equalTo(pollingStrategy.apply((long) callNumber))));
Thread.sleep(duration.in(TimeUnit.MILLISECONDS));
}).withPollingStrategy(info -> new Duration(pollingStrategy.apply(info.getNumber()), TimeUnit.SECONDS))
.withTimeout(4, TimeUnit.SECONDS)
.pollingEvery(1, TimeUnit.SECONDS);
try {
Expand Down

0 comments on commit f2d377b

Please sign in to comment.