From 9363e2ba4192cec0576ff796357d98fcd34d4d15 Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Fri, 27 Oct 2017 17:32:28 -0500 Subject: [PATCH] Polish ReactorContextTestExecutionListenerTests Necessary for preparing for the changes that will be made. The Context should not necessarily be empty, but it should not contain the SecurityContext Issue gh-4718 --- .../ReactorContextTestExecutionListenerTests.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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 {