diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java index 6429d46485..112a6e03f4 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java @@ -16,11 +16,6 @@ package org.springframework.boot.autoconfigure.security; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -51,6 +46,11 @@ import org.springframework.security.web.FilterChainProxy; import org.springframework.security.web.SecurityFilterChain; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + /** * Tests for {@link SecurityAutoConfiguration}. * @@ -62,8 +62,8 @@ public class SecurityAutoConfigurationTests { @After public void close() { - if (context != null) { - context.close(); + if (this.context != null) { + this.context.close(); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java index d9ac6b13a5..10c6e640a4 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java @@ -16,9 +16,6 @@ package org.springframework.boot.autoconfigure.security; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -48,6 +45,9 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + /** * Tests for {@link SpringBootWebSecurityConfiguration}. * @@ -59,8 +59,8 @@ public class SpringBootWebSecurityConfigurationTests { @After public void close() { - if (context != null) { - context.close(); + if (this.context != null) { + this.context.close(); } } @@ -95,7 +95,7 @@ public class SpringBootWebSecurityConfigurationTests { WebSecurityConfigurerAdapter { // It's a bad idea to inject an AuthenticationManager into a - // WebSecurityConfigurerAdapter because it can cascade early instantiation, + // WebSecurityConfigurerAdapter because it can cascade early instantiation, // unless you explicitly want the Boot default AuthenticationManager. It's // better to inject the builder, if you want the global AuthenticationManager. It // might even be necessary to wrap the builder in a lazy AuthenticationManager @@ -106,8 +106,9 @@ public class SpringBootWebSecurityConfigurationTests { @Override public void init(WebSecurity web) throws Exception { - auth.getOrBuild(); + this.auth.getOrBuild(); } + } @MinimalWebConfiguration @@ -118,10 +119,8 @@ public class SpringBootWebSecurityConfigurationTests { @Autowired public void init(AuthenticationManagerBuilder auth) throws Exception { // @formatter:off - auth.inMemoryAuthentication() - .withUser("dave") - .password("secret") - .roles("USER"); + auth.inMemoryAuthentication().withUser("dave").password("secret") + .roles("USER"); // @formatter:on } @@ -142,6 +141,7 @@ public class SpringBootWebSecurityConfigurationTests { HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) protected static @interface MinimalWebConfiguration { + } }