serverRedirectStrategy->redirectStrategy

Issue: gh-4822
This commit is contained in:
Rob Winch
2017-11-14 15:24:16 -06:00
parent 2cbdb4ba02
commit 1c977ca15f
7 changed files with 33 additions and 33 deletions

View File

@@ -44,7 +44,7 @@ public class RedirectServerAuthenticationEntryPointTests {
@Mock
private ServerWebExchange exchange;
@Mock
private ServerRedirectStrategy serverRedirectStrategy;
private ServerRedirectStrategy redirectStrategy;
private String location = "/login";
@@ -83,8 +83,8 @@ public class RedirectServerAuthenticationEntryPointTests {
@Test
public void commenceWhenCustomServerRedirectStrategyThenCustomServerRedirectStrategyUsed() {
PublisherProbe<Void> redirectResult = PublisherProbe.empty();
when(this.serverRedirectStrategy.sendRedirect(any(), any())).thenReturn(redirectResult.mono());
this.entryPoint.setServerRedirectStrategy(this.serverRedirectStrategy);
when(this.redirectStrategy.sendRedirect(any(), any())).thenReturn(redirectResult.mono());
this.entryPoint.setRedirectStrategy(this.redirectStrategy);
this.exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").build());
this.entryPoint.commence(this.exchange, this.exception).block();
@@ -94,6 +94,6 @@ public class RedirectServerAuthenticationEntryPointTests {
@Test(expected = IllegalArgumentException.class)
public void setRedirectStrategyWhenNullThenException() {
this.entryPoint.setServerRedirectStrategy(null);
this.entryPoint.setRedirectStrategy(null);
}
}

View File

@@ -44,7 +44,7 @@ public class RedirectServerAuthenticationFailureHandlerTests {
private WebFilterExchange exchange;
@Mock
private ServerRedirectStrategy serverRedirectStrategy;
private ServerRedirectStrategy redirectStrategy;
private String location = "/login";
@@ -83,8 +83,8 @@ public class RedirectServerAuthenticationFailureHandlerTests {
@Test
public void commenceWhenCustomServerRedirectStrategyThenCustomServerRedirectStrategyUsed() {
PublisherProbe<Void> redirectResult = PublisherProbe.empty();
when(this.serverRedirectStrategy.sendRedirect(any(), any())).thenReturn(redirectResult.mono());
this.handler.setServerRedirectStrategy(this.serverRedirectStrategy);
when(this.redirectStrategy.sendRedirect(any(), any())).thenReturn(redirectResult.mono());
this.handler.setRedirectStrategy(this.redirectStrategy);
this.exchange = createExchange();
this.handler.onAuthenticationFailure(this.exchange, this.exception).block();
@@ -94,7 +94,7 @@ public class RedirectServerAuthenticationFailureHandlerTests {
@Test(expected = IllegalArgumentException.class)
public void setRedirectStrategyWhenNullThenException() {
this.handler.setServerRedirectStrategy(null);
this.handler.setRedirectStrategy(null);
}
private WebFilterExchange createExchange() {

View File

@@ -50,7 +50,7 @@ public class RedirectServerAuthenticationSuccessHandlerTests {
@Mock
private WebFilterChain chain;
@Mock
private ServerRedirectStrategy serverRedirectStrategy;
private ServerRedirectStrategy redirectStrategy;
@Mock
private Authentication authentication;
@@ -90,19 +90,19 @@ public class RedirectServerAuthenticationSuccessHandlerTests {
@Test
public void successWhenCustomLocationThenCustomLocationUsed() {
PublisherProbe<Void> redirectResult = PublisherProbe.empty();
when(this.serverRedirectStrategy.sendRedirect(any(), any())).thenReturn(redirectResult.mono());
this.handler.setServerRedirectStrategy(this.serverRedirectStrategy);
when(this.redirectStrategy.sendRedirect(any(), any())).thenReturn(redirectResult.mono());
this.handler.setRedirectStrategy(this.redirectStrategy);
this.exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").build());
this.handler.onAuthenticationSuccess(new WebFilterExchange(this.exchange,
this.chain), this.authentication).block();
redirectResult.assertWasSubscribed();
verify(this.serverRedirectStrategy).sendRedirect(any(), eq(this.location));
verify(this.redirectStrategy).sendRedirect(any(), eq(this.location));
}
@Test(expected = IllegalArgumentException.class)
public void setRedirectStrategyWhenNullThenException() {
this.handler.setServerRedirectStrategy(null);
this.handler.setRedirectStrategy(null);
}
@Test(expected = IllegalArgumentException.class)