Remove Mono.defer in ReactorContextWebFilter

Fixes: gh-5010
This commit is contained in:
Rob Winch
2018-02-08 16:19:10 -06:00
parent 66298dcf5d
commit ce5fb51b20
3 changed files with 14 additions and 6 deletions

View File

@@ -33,6 +33,7 @@ import org.springframework.web.server.WebFilterChain;
import org.springframework.web.server.handler.DefaultWebFilterChain;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import reactor.test.publisher.TestPublisher;
import reactor.util.context.Context;
import static org.assertj.core.api.Assertions.assertThat;
@@ -53,6 +54,8 @@ public class ReactorContextWebFilterTests {
private MockServerHttpRequest.BaseBuilder<?> exchange = MockServerHttpRequest.get("/");
private TestPublisher<SecurityContext> securityContext = TestPublisher.create();
private ReactorContextWebFilter filter;
private WebTestHandler handler;
@@ -62,6 +65,7 @@ public class ReactorContextWebFilterTests {
public void setup() {
this.filter = new ReactorContextWebFilter(this.repository);
this.handler = WebTestHandler.bindToWebFilters(this.filter);
when(this.repository.load(any())).thenReturn(this.securityContext.mono());
}
@Test(expected = IllegalArgumentException.class)
@@ -74,7 +78,7 @@ public class ReactorContextWebFilterTests {
public void filterWhenNoPrincipalAccessThenNoInteractions() {
this.handler.exchange(this.exchange);
verifyZeroInteractions(this.repository);
this.securityContext.assertWasNotSubscribed();
}
@Test
@@ -86,7 +90,7 @@ public class ReactorContextWebFilterTests {
this.handler.exchange(this.exchange);
verifyZeroInteractions(this.repository);
this.securityContext.assertWasNotSubscribed();
}
@Test
@@ -102,7 +106,7 @@ public class ReactorContextWebFilterTests {
WebTestHandler.WebHandlerResult result = this.handler.exchange(this.exchange);
verify(this.repository).load(any());
this.securityContext.assertWasNotSubscribed();
}
@Test