Avoid testing time, because on CIs, time is very relative...
@@ -148,7 +148,7 @@ public class UniOnResultDelayTest {
}
@Test
- public void testWithMultipleDelays() throws InterruptedException {
+ public void testWithMultipleDelays() {
AtomicLong counter = new AtomicLong();
AtomicReference<Throwable> failure = new AtomicReference<>();
Uni.createFrom().nullValue().onResult().delayIt()
@@ -168,15 +168,8 @@ public class UniOnResultDelayTest {
.onExecutor(executor)
.by(Duration.ofMillis(800)).subscribe().with(v -> counter.incrementAndGet(), failure::set);
- assertThat(counter.intValue()).isEqualTo(0);
+ await().until(() -> counter.intValue() == 4);
assertThat(failure.get()).isNull();
- Thread.sleep(250);
- assertThat(counter.intValue()).isEqualTo(2);
- assertThat(failure.get()).isNull();
-
- Thread.sleep(1000);
- assertThat(counter.intValue()).isEqualTo(4);
- assertThat(failure.get()).isNull();
}
}
\ No newline at end of file
