Skip to content

Commit 7df9db3

Browse files
committed
Polishing test
Assert that BlockHound doesn't trigger, rather than assertions on a condition that makes the test flakky because concurrency is involved.
1 parent bd9c05a commit 7df9db3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.springframework.util.ConcurrentReferenceHashMap;
3030

3131
import static org.assertj.core.api.Assertions.assertThat;
32+
import static org.assertj.core.api.Assertions.assertThatNoException;
3233
import static org.assertj.core.api.Assertions.assertThatThrownBy;
3334
import static org.junit.jupiter.api.condition.JRE.JAVA_18;
3435

@@ -107,8 +108,9 @@ void concurrentReferenceHashMapSegmentClear() {
107108
}
108109
}, future2);
109110

110-
CompletableFuture.allOf(future1, future2).join();
111-
assertThat(map).isEmpty();
111+
//ensure blockhound doesn't trigger
112+
final CompletableFuture<Void> allOf = CompletableFuture.allOf(future1, future2);
113+
assertThatNoException().isThrownBy(allOf::join);
112114
}
113115

114116
private void testNonBlockingTask(NonBlockingTask task) {

0 commit comments

Comments
 (0)