diff --git a/test/src/test/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListenerTests.java b/test/src/test/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListenerTests.java index 508963f64c..3e12c386b9 100644 --- a/test/src/test/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListenerTests.java +++ b/test/src/test/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListenerTests.java @@ -60,7 +60,11 @@ public class ReactorContextTestExecutionListenerTests { public void beforeTestMethodWhenSecurityContextEmptyThenReactorContextNull() throws Exception { this.listener.beforeTestMethod(this.testContext); - assertThat(Mono.subscriberContext().block().isEmpty()).isTrue(); + Mono result = ReactiveSecurityContextHolder + .getContext(); + + StepVerifier.create(result) + .verifyComplete(); } @Test @@ -69,9 +73,12 @@ public class ReactorContextTestExecutionListenerTests { this.listener.beforeTestMethod(this.testContext); - assertThat(Mono.subscriberContext().block().isEmpty()).isTrue(); - } + Mono result = ReactiveSecurityContextHolder + .getContext(); + StepVerifier.create(result) + .verifyComplete(); + } @Test public void beforeTestMethodWhenAuthenticationThenReactorContextHasAuthentication() throws Exception {