Apply updated Code Style

Closes gh-13881
This commit is contained in:
Marcus Da Coregio
2023-09-29 11:44:32 -03:00
parent 650692964e
commit 64e2a2ff8b
1172 changed files with 10805 additions and 8768 deletions

View File

@@ -114,7 +114,7 @@ public class AbstractAuthorizeTagTests {
this.tag.setUrl(uri);
WebApplicationContext wac = mock(WebApplicationContext.class);
given(wac.getBeansOfType(WebInvocationPrivilegeEvaluator.class))
.willReturn(Collections.singletonMap("wipe", expected));
.willReturn(Collections.singletonMap("wipe", expected));
given(wac.getBeanNamesForType(SecurityContextHolderStrategy.class)).willReturn(new String[0]);
this.servletContext.setAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcher", wac);
this.tag.authorizeUsingUrlCheck();
@@ -129,7 +129,7 @@ public class AbstractAuthorizeTagTests {
this.tag.setAccess("permitAll");
WebApplicationContext wac = mock(WebApplicationContext.class);
given(wac.getBeansOfType(SecurityExpressionHandler.class))
.willReturn(Collections.<String, SecurityExpressionHandler>singletonMap("wipe", expected));
.willReturn(Collections.<String, SecurityExpressionHandler>singletonMap("wipe", expected));
given(wac.getBeanNamesForType(SecurityContextHolderStrategy.class)).willReturn(new String[0]);
this.servletContext.setAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcher", wac);
assertThat(this.tag.authorize()).isTrue();

View File

@@ -124,7 +124,7 @@ public class AccessControlListTagTests {
public void childContext() throws Exception {
ServletContext servletContext = this.pageContext.getServletContext();
WebApplicationContext wac = (WebApplicationContext) servletContext
.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
servletContext.removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
servletContext.setAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcher", wac);
Object domainObject = new Object();

View File

@@ -69,8 +69,8 @@ public class AuthenticationTagTests {
@Test
public void testOperationWhenPrincipalIsAString() throws JspException {
SecurityContextHolder.getContext().setAuthentication(
new TestingAuthenticationToken("rodAsString", "koala", AuthorityUtils.NO_AUTHORITIES));
SecurityContextHolder.getContext()
.setAuthentication(new TestingAuthenticationToken("rodAsString", "koala", AuthorityUtils.NO_AUTHORITIES));
this.authenticationTag.setProperty("principal");
assertThat(this.authenticationTag.doStartTag()).isEqualTo(Tag.SKIP_BODY);
assertThat(this.authenticationTag.doEndTag()).isEqualTo(Tag.EVAL_PAGE);
@@ -89,7 +89,7 @@ public class AuthenticationTagTests {
@Test
public void testOperationWhenPrincipalIsNull() throws JspException {
SecurityContextHolder.getContext()
.setAuthentication(new TestingAuthenticationToken(null, "koala", AuthorityUtils.NO_AUTHORITIES));
.setAuthentication(new TestingAuthenticationToken(null, "koala", AuthorityUtils.NO_AUTHORITIES));
this.authenticationTag.setProperty("principal");
assertThat(this.authenticationTag.doStartTag()).isEqualTo(Tag.SKIP_BODY);
assertThat(this.authenticationTag.doEndTag()).isEqualTo(Tag.EVAL_PAGE);

View File

@@ -67,7 +67,7 @@ public class AuthorizeTagTests {
SecurityContextHolder.getContext().setAuthentication(this.currentUser);
StaticWebApplicationContext ctx = new StaticWebApplicationContext();
BeanDefinitionBuilder webExpressionHandler = BeanDefinitionBuilder
.rootBeanDefinition(DefaultWebSecurityExpressionHandler.class);
.rootBeanDefinition(DefaultWebSecurityExpressionHandler.class);
webExpressionHandler.addPropertyValue("permissionEvaluator", this.permissionEvaluator);
ctx.registerBeanDefinition("expressionHandler", webExpressionHandler.getBeanDefinition());
ctx.registerSingleton("wipe", MockWebInvocationPrivilegeEvaluator.class);

View File

@@ -60,7 +60,7 @@ public class AbstractCsrfTagTests {
int returned = this.tag.doEndTag();
assertThat(returned).as("The returned value is not correct.").isEqualTo(Tag.EVAL_PAGE);
assertThat(this.response.getContentAsString()).withFailMessage("The output value is not correct.")
.isEqualTo("");
.isEqualTo("");
}
@Test
@@ -71,7 +71,7 @@ public class AbstractCsrfTagTests {
int returned = this.tag.doEndTag();
assertThat(returned).as("The returned value is not correct.").isEqualTo(Tag.EVAL_PAGE);
assertThat(this.response.getContentAsString()).withFailMessage("The output value is not correct.")
.isEqualTo("fooBarBazQux");
.isEqualTo("fooBarBazQux");
assertThat(this.tag.token).as("The token is not correct.").isSameAs(token);
}
@@ -83,7 +83,7 @@ public class AbstractCsrfTagTests {
int returned = this.tag.doEndTag();
assertThat(returned).as("The returned value is not correct.").isEqualTo(Tag.EVAL_PAGE);
assertThat(this.response.getContentAsString()).withFailMessage("The output value is not correct.")
.isEqualTo("<input type=\"hidden\" />");
.isEqualTo("<input type=\"hidden\" />");
assertThat(this.tag.token).as("The token is not correct.").isSameAs(token);
}

View File

@@ -42,7 +42,7 @@ public class CsrfInputTagTests {
String value = this.tag.handleToken(token);
assertThat(value).as("The returned value should not be null.").isNotNull();
assertThat(value).withFailMessage("The output is not correct.")
.isEqualTo("<input type=\"hidden\" name=\"_csrf\" value=\"abc123def456ghi789\" />");
.isEqualTo("<input type=\"hidden\" name=\"_csrf\" value=\"abc123def456ghi789\" />");
}
@Test
@@ -51,7 +51,7 @@ public class CsrfInputTagTests {
String value = this.tag.handleToken(token);
assertThat(value).as("The returned value should not be null.").isNotNull();
assertThat(value).withFailMessage("The output is not correct.")
.isEqualTo("<input type=\"hidden\" name=\"csrfParameter\" value=\"fooBarBazQux\" />");
.isEqualTo("<input type=\"hidden\" name=\"csrfParameter\" value=\"fooBarBazQux\" />");
}
}

View File

@@ -42,9 +42,9 @@ public class CsrfMetaTagsTagTests {
String value = this.tag.handleToken(token);
assertThat(value).as("The returned value should not be null.").isNotNull();
assertThat(value).withFailMessage("The output is not correct.")
.isEqualTo("<meta name=\"_csrf_parameter\" content=\"_csrf\" />"
+ "<meta name=\"_csrf_header\" content=\"X-Csrf-Token\" />"
+ "<meta name=\"_csrf\" content=\"abc123def456ghi789\" />");
.isEqualTo("<meta name=\"_csrf_parameter\" content=\"_csrf\" />"
+ "<meta name=\"_csrf_header\" content=\"X-Csrf-Token\" />"
+ "<meta name=\"_csrf\" content=\"abc123def456ghi789\" />");
}
@Test
@@ -53,9 +53,9 @@ public class CsrfMetaTagsTagTests {
String value = this.tag.handleToken(token);
assertThat(value).as("The returned value should not be null.").isNotNull();
assertThat(value).withFailMessage("The output is not correct.")
.isEqualTo("<meta name=\"_csrf_parameter\" content=\"csrfParameter\" />"
+ "<meta name=\"_csrf_header\" content=\"csrfHeader\" />"
+ "<meta name=\"_csrf\" content=\"fooBarBazQux\" />");
.isEqualTo("<meta name=\"_csrf_parameter\" content=\"csrfParameter\" />"
+ "<meta name=\"_csrf_header\" content=\"csrfHeader\" />"
+ "<meta name=\"_csrf\" content=\"fooBarBazQux\" />");
}
}