Polishing test

Assert that BlockHound doesn't trigger, rather than assertions on a
condition that makes the test flakky because concurrency is involved.
This commit is contained in:
Simon Baslé 2024-09-24 10:59:23 +02:00
parent bd9c05a909
commit 7df9db3bb7
1 changed files with 4 additions and 2 deletions

View File

@ -29,6 +29,7 @@ import reactor.core.scheduler.Schedulers;
import org.springframework.util.ConcurrentReferenceHashMap; import org.springframework.util.ConcurrentReferenceHashMap;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatNoException;
import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.condition.JRE.JAVA_18; import static org.junit.jupiter.api.condition.JRE.JAVA_18;
@ -107,8 +108,9 @@ class SpringCoreBlockHoundIntegrationTests {
} }
}, future2); }, future2);
CompletableFuture.allOf(future1, future2).join(); //ensure blockhound doesn't trigger
assertThat(map).isEmpty(); final CompletableFuture<Void> allOf = CompletableFuture.allOf(future1, future2);
assertThatNoException().isThrownBy(allOf::join);
} }
private void testNonBlockingTask(NonBlockingTask task) { private void testNonBlockingTask(NonBlockingTask task) {