From fe2b1f9345c2b93ca99b7ebbe68bd67c21141f1c Mon Sep 17 00:00:00 2001 From: ChickenchickenLove Date: Sat, 30 Mar 2024 22:51:45 +0900 Subject: [PATCH] #3772: wrap with await().untilAsserted. --- .../BoundedElasticThreadPerTaskSchedulerTest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/reactor-core/src/test/java21/reactor/core/scheduler/BoundedElasticThreadPerTaskSchedulerTest.java b/reactor-core/src/test/java21/reactor/core/scheduler/BoundedElasticThreadPerTaskSchedulerTest.java index 3f0f8c5ab8..d19dd4c7e6 100644 --- a/reactor-core/src/test/java21/reactor/core/scheduler/BoundedElasticThreadPerTaskSchedulerTest.java +++ b/reactor-core/src/test/java21/reactor/core/scheduler/BoundedElasticThreadPerTaskSchedulerTest.java @@ -75,7 +75,7 @@ public void ensuresTasksScheduling() throws InterruptedException { Disposable disposable = scheduler.schedule(latch::countDown); Assertions.assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); - Assertions.assertThat(disposable.isDisposed()).isTrue(); + Awaitility.await().untilAsserted(() -> Assertions.assertThat(disposable.isDisposed()).isTrue()); } @Test @@ -108,7 +108,7 @@ public void ensuresTasksDelayedScheduling() throws InterruptedException { .until(() -> ((ScheduledThreadPoolExecutor) resource.sharedDelayedTasksScheduler).getQueue().isEmpty()); Assertions.assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); - Assertions.assertThat(disposable.isDisposed()).isTrue(); + Awaitility.await().untilAsserted(() -> Assertions.assertThat(disposable.isDisposed()).isTrue()); } @Test @@ -135,7 +135,7 @@ public void ensuresTasksDelayedZeroDelayScheduling() throws InterruptedException Assertions.assertThat(((ScheduledThreadPoolExecutor) resource.sharedDelayedTasksScheduler).getQueue().size()).isZero(); Assertions.assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); - Assertions.assertThat(disposable.isDisposed()).isTrue(); + Awaitility.await().untilAsserted(() -> Assertions.assertThat(disposable.isDisposed()).isTrue()); // unblock scheduler awaiter.countDown(); @@ -153,7 +153,7 @@ public void ensuresTasksPeriodicScheduling() throws InterruptedException { Assertions.assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); Assertions.assertThat(disposable.isDisposed()).isFalse(); disposable.dispose(); - Assertions.assertThat(disposable.isDisposed()).isTrue(); + Awaitility.await().untilAsserted(() -> Assertions.assertThat(disposable.isDisposed()).isTrue()); } @Test @@ -168,7 +168,7 @@ public void ensuresTasksPeriodicZeroInitialDelayScheduling() throws InterruptedE Assertions.assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); Assertions.assertThat(disposable.isDisposed()).isFalse(); disposable.dispose(); - Assertions.assertThat(disposable.isDisposed()).isTrue(); + Awaitility.await().untilAsserted(() -> Assertions.assertThat(disposable.isDisposed()).isTrue()); } @Test @@ -183,7 +183,7 @@ public void ensuresTasksPeriodicWithInitialDelayAndInstantPeriodScheduling() thr Assertions.assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); Assertions.assertThat(disposable.isDisposed()).isFalse(); disposable.dispose(); - Assertions.assertThat(disposable.isDisposed()).isTrue(); + Awaitility.await().untilAsserted(() -> Assertions.assertThat(disposable.isDisposed()).isTrue()); } @Test @@ -198,7 +198,7 @@ public void ensuresTasksPeriodicWithZeroInitialDelayAndInstantPeriodScheduling() Assertions.assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); Assertions.assertThat(disposable.isDisposed()).isFalse(); disposable.dispose(); - Assertions.assertThat(disposable.isDisposed()).isTrue(); + Awaitility.await().untilAsserted(() -> Assertions.assertThat(disposable.isDisposed()).isTrue()); } @Test