Apply Checkstyle WhitespaceAfterCheck module
This commit is contained in:
@@ -90,7 +90,7 @@ public class DigestAuthUtilsTests {
|
||||
public void testSplitNormalOperation() {
|
||||
String unsplit = "username=\"rod==\"";
|
||||
assertThat(DigestAuthUtils.split(unsplit, "=")[0]).isEqualTo("username");
|
||||
assertThat(DigestAuthUtils.split(unsplit, "=")[1]).isEqualTo("\"rod==\"");// should
|
||||
assertThat(DigestAuthUtils.split(unsplit, "=")[1]).isEqualTo("\"rod==\""); // should
|
||||
// not
|
||||
// remove
|
||||
// quotes
|
||||
|
||||
@@ -84,7 +84,7 @@ public class SavedCookieMixinTests extends AbstractMixinTests {
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void deserializeSavedCookieWithList() throws IOException, JSONException {
|
||||
List<SavedCookie> savedCookies = (List<SavedCookie>)mapper.readValue(COOKIES_JSON, Object.class);
|
||||
List<SavedCookie> savedCookies = (List<SavedCookie>) mapper.readValue(COOKIES_JSON, Object.class);
|
||||
assertThat(savedCookies).isNotNull().hasSize(1);
|
||||
assertThat(savedCookies.get(0).getName()).isEqualTo("SESSION");
|
||||
assertThat(savedCookies.get(0).getValue()).isEqualTo("123456789");
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ServerFormLoginAuthenticationConverterTests {
|
||||
@Mock
|
||||
private ServerWebExchange exchange;
|
||||
|
||||
private MultiValueMap<String,String> data = new LinkedMultiValueMap<>();
|
||||
private MultiValueMap<String, String> data = new LinkedMultiValueMap<>();
|
||||
|
||||
private ServerFormLoginAuthenticationConverter converter = new ServerFormLoginAuthenticationConverter();
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class AuthenticationWebFilterTests {
|
||||
@Mock
|
||||
private ServerAuthenticationSuccessHandler successHandler;
|
||||
@Mock
|
||||
private Function<ServerWebExchange,Mono<Authentication>> authenticationConverter;
|
||||
private Function<ServerWebExchange, Mono<Authentication>> authenticationConverter;
|
||||
@Mock
|
||||
private ReactiveAuthenticationManager authenticationManager;
|
||||
@Mock
|
||||
@@ -96,7 +96,7 @@ public class AuthenticationWebFilterTests {
|
||||
|
||||
@Test
|
||||
public void filterWhenDefaultsAndAuthenticationSuccessThenContinues() {
|
||||
when(this.authenticationManager.authenticate(any())).thenReturn(Mono.just(new TestingAuthenticationToken("test","this", "ROLE")));
|
||||
when(this.authenticationManager.authenticate(any())).thenReturn(Mono.just(new TestingAuthenticationToken("test", "this", "ROLE")));
|
||||
this.filter = new AuthenticationWebFilter(this.authenticationManager);
|
||||
|
||||
WebTestClient client = WebTestClientBuilder
|
||||
@@ -185,7 +185,7 @@ public class AuthenticationWebFilterTests {
|
||||
when(this.authenticationConverter.apply(any())).thenReturn(authentication);
|
||||
when(this.authenticationManager.authenticate(any())).thenReturn(authentication);
|
||||
when(this.successHandler.onAuthenticationSuccess(any(), any())).thenReturn(Mono.empty());
|
||||
when(this.securityContextRepository.save(any(),any())).thenAnswer( a -> Mono.just(a.getArguments()[0]));
|
||||
when(this.securityContextRepository.save(any(), any())).thenAnswer( a -> Mono.just(a.getArguments()[0]));
|
||||
|
||||
WebTestClient client = WebTestClientBuilder
|
||||
.bindToWebFilters(this.filter)
|
||||
@@ -231,7 +231,7 @@ public class AuthenticationWebFilterTests {
|
||||
Mono<Authentication> authentication = Mono.just(new TestingAuthenticationToken("test", "this", "ROLE_USER"));
|
||||
when(this.authenticationConverter.apply(any())).thenReturn(authentication);
|
||||
when(this.authenticationManager.authenticate(any())).thenReturn(Mono.error(new BadCredentialsException("Failed")));
|
||||
when(this.failureHandler.onAuthenticationFailure(any(),any())).thenReturn(Mono.empty());
|
||||
when(this.failureHandler.onAuthenticationFailure(any(), any())).thenReturn(Mono.empty());
|
||||
|
||||
WebTestClient client = WebTestClientBuilder
|
||||
.bindToWebFilters(this.filter)
|
||||
@@ -244,7 +244,7 @@ public class AuthenticationWebFilterTests {
|
||||
.expectStatus().isOk()
|
||||
.expectBody().isEmpty();
|
||||
|
||||
verify(this.failureHandler).onAuthenticationFailure(any(),any());
|
||||
verify(this.failureHandler).onAuthenticationFailure(any(), any());
|
||||
verify(this.securityContextRepository, never()).save(any(), any());
|
||||
verifyZeroInteractions(this.successHandler);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class AuthorizationWebFilterTests {
|
||||
@Test
|
||||
public void filterWhenNoSecurityContextThenThrowsAccessDenied() {
|
||||
when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
|
||||
Mono<Void> result = filter.filter(this.exchange, this.chain);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class AuthorizationWebFilterTests {
|
||||
@Test
|
||||
public void filterWhenNoAuthenticationThenThrowsAccessDenied() {
|
||||
when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
|
||||
Mono<Void> result = filter
|
||||
.filter(this.exchange, this.chain)
|
||||
@@ -78,11 +78,11 @@ public class AuthorizationWebFilterTests {
|
||||
@Test
|
||||
public void filterWhenAuthenticationThenThrowsAccessDenied() {
|
||||
when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
|
||||
Mono<Void> result = filter
|
||||
.filter(this.exchange, this.chain)
|
||||
.subscriberContext(ReactiveSecurityContextHolder.withAuthentication(new TestingAuthenticationToken("a","b", "R")));
|
||||
.subscriberContext(ReactiveSecurityContextHolder.withAuthentication(new TestingAuthenticationToken("a", "b", "R")));
|
||||
|
||||
StepVerifier.create(result)
|
||||
.expectError(AccessDeniedException.class)
|
||||
@@ -94,7 +94,7 @@ public class AuthorizationWebFilterTests {
|
||||
public void filterWhenDoesNotAccessAuthenticationThenSecurityContextNotSubscribed() {
|
||||
PublisherProbe<SecurityContext> context = PublisherProbe.empty();
|
||||
when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
|
||||
Mono<Void> result = filter
|
||||
.filter(this.exchange, this.chain)
|
||||
@@ -111,7 +111,7 @@ public class AuthorizationWebFilterTests {
|
||||
public void filterWhenGrantedAndDoesNotAccessAuthenticationThenChainSubscribedAndSecurityContextNotSubscribed() {
|
||||
PublisherProbe<SecurityContext> context = PublisherProbe.empty();
|
||||
when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.just(new AuthorizationDecision(true)));
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.just(new AuthorizationDecision(true)));
|
||||
|
||||
Mono<Void> result = filter
|
||||
.filter(this.exchange, this.chain)
|
||||
@@ -127,7 +127,7 @@ public class AuthorizationWebFilterTests {
|
||||
public void filterWhenGrantedAndDoeAccessAuthenticationThenChainSubscribedAndSecurityContextSubscribed() {
|
||||
PublisherProbe<SecurityContext> context = PublisherProbe.empty();
|
||||
when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> a
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> a
|
||||
.map( auth -> new AuthorizationDecision(true))
|
||||
.defaultIfEmpty(new AuthorizationDecision(true))
|
||||
);
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ReactorContextWebFilterTests {
|
||||
|
||||
@Test
|
||||
public void filterWhenGetPrincipalMonoThenNoInteractions() {
|
||||
this.handler = WebTestHandler.bindToWebFilters(this.filter, (e,c) -> {
|
||||
this.handler = WebTestHandler.bindToWebFilters(this.filter, (e, c) -> {
|
||||
ReactiveSecurityContextHolder.getContext();
|
||||
return c.filter(e);
|
||||
});
|
||||
@@ -88,7 +88,7 @@ public class ReactorContextWebFilterTests {
|
||||
public void filterWhenPrincipalAndGetPrincipalThenInteractAndUseOriginalPrincipal() {
|
||||
SecurityContextImpl context = new SecurityContextImpl(this.principal);
|
||||
when(this.repository.load(any())).thenReturn(Mono.just(context));
|
||||
this.handler = WebTestHandler.bindToWebFilters(this.filter, (e,c) ->
|
||||
this.handler = WebTestHandler.bindToWebFilters(this.filter, (e, c) ->
|
||||
ReactiveSecurityContextHolder.getContext()
|
||||
.map(SecurityContext::getAuthentication)
|
||||
.doOnSuccess( p -> assertThat(p).isSameAs(this.principal))
|
||||
|
||||
@@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class SecurityContextServerWebExchangeWebFilterTests {
|
||||
SecurityContextServerWebExchangeWebFilter filter = new SecurityContextServerWebExchangeWebFilter();
|
||||
|
||||
Authentication principal = new TestingAuthenticationToken("user","password", "ROLE_USER");
|
||||
Authentication principal = new TestingAuthenticationToken("user", "password", "ROLE_USER");
|
||||
|
||||
ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").build());
|
||||
|
||||
@@ -73,7 +73,7 @@ public class SecurityContextServerWebExchangeWebFilterTests {
|
||||
|
||||
@Test
|
||||
public void filterWhenPrincipalNullThenContextEmpty() {
|
||||
Authentication defaultAuthentication = new TestingAuthenticationToken("anonymouse","anonymous", "TEST");
|
||||
Authentication defaultAuthentication = new TestingAuthenticationToken("anonymouse", "anonymous", "TEST");
|
||||
Mono<Void> result = this.filter.filter(this.exchange, new DefaultWebFilterChain( e ->
|
||||
e.getPrincipal()
|
||||
.defaultIfEmpty(defaultAuthentication)
|
||||
|
||||
@@ -94,9 +94,9 @@ public class OnCommittedResponseWrapperTests {
|
||||
int off = 2;
|
||||
int len = 3;
|
||||
|
||||
response.getWriter().write(buff,off,len);
|
||||
response.getWriter().write(buff, off, len);
|
||||
|
||||
verify(writer).write(buff,off,len);
|
||||
verify(writer).write(buff, off, len);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -114,9 +114,9 @@ public class OnCommittedResponseWrapperTests {
|
||||
int off = 2;
|
||||
int len = 3;
|
||||
|
||||
response.getWriter().write(s,off,len);
|
||||
response.getWriter().write(s, off, len);
|
||||
|
||||
verify(writer).write(s,off,len);
|
||||
verify(writer).write(s, off, len);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -602,7 +602,7 @@ public class OnCommittedResponseWrapperTests {
|
||||
int len = 3;
|
||||
response.setContentLength(3);
|
||||
|
||||
response.getWriter().write(buff,off,len);
|
||||
response.getWriter().write(buff, off, len);
|
||||
|
||||
assertThat(committed).isTrue();
|
||||
}
|
||||
@@ -624,7 +624,7 @@ public class OnCommittedResponseWrapperTests {
|
||||
int len = 3;
|
||||
response.setContentLength(3);
|
||||
|
||||
response.getWriter().write(s,off,len);
|
||||
response.getWriter().write(s, off, len);
|
||||
|
||||
assertThat(committed).isTrue();
|
||||
}
|
||||
@@ -1104,7 +1104,7 @@ public class OnCommittedResponseWrapperTests {
|
||||
@Test
|
||||
public void addHeaderContentLengthPrintWriterWriteStringCommits() throws Exception {
|
||||
int expected = 1234;
|
||||
response.addHeader("Content-Length",String.valueOf(String.valueOf(expected).length()));
|
||||
response.addHeader("Content-Length", String.valueOf(String.valueOf(expected).length()));
|
||||
|
||||
response.getWriter().write(expected);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user