Browse Source

openrewrite Junit Migration

pull/10069/head
Rob Winch 5 years ago
parent
commit
3e93b024d6
  1. 2
      acl/src/test/java/org/springframework/security/acls/AclFormattingUtilsTests.java
  2. 2
      acl/src/test/java/org/springframework/security/acls/AclPermissionCacheOptimizerTests.java
  3. 2
      acl/src/test/java/org/springframework/security/acls/AclPermissionEvaluatorTests.java
  4. 2
      acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationCollectionFilteringProviderTests.java
  5. 2
      acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationProviderTests.java
  6. 2
      acl/src/test/java/org/springframework/security/acls/domain/AccessControlImplEntryTests.java
  7. 16
      acl/src/test/java/org/springframework/security/acls/domain/AclAuthorizationStrategyImplTests.java
  8. 10
      acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java
  9. 10
      acl/src/test/java/org/springframework/security/acls/domain/AclImplementationSecurityCheckTests.java
  10. 10
      acl/src/test/java/org/springframework/security/acls/domain/AuditLoggerTests.java
  11. 2
      acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityImplTests.java
  12. 2
      acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityRetrievalStrategyImplTests.java
  13. 6
      acl/src/test/java/org/springframework/security/acls/domain/PermissionTests.java
  14. 20
      acl/src/test/java/org/springframework/security/acls/jdbc/AbstractBasicLookupStrategyTests.java
  15. 12
      acl/src/test/java/org/springframework/security/acls/jdbc/AclClassIdUtilsTests.java
  16. 8
      acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyTests.java
  17. 16
      acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyWithAclClassTypeTests.java
  18. 16
      acl/src/test/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCacheTests.java
  19. 18
      acl/src/test/java/org/springframework/security/acls/jdbc/JdbcAclServiceTests.java
  20. 2
      acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTests.java
  21. 2
      acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTestsWithAclClassId.java
  22. 10
      acl/src/test/java/org/springframework/security/acls/jdbc/SpringCacheBasedAclCacheTests.java
  23. 2
      acl/src/test/java/org/springframework/security/acls/sid/SidRetrievalStrategyTests.java
  24. 2
      acl/src/test/java/org/springframework/security/acls/sid/SidTests.java
  25. 10
      aspects/src/test/java/org/springframework/security/access/intercept/aspectj/aspect/AnnotationSecurityAspectTests.java
  26. 2
      cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationProviderTests.java
  27. 2
      cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationTokenTests.java
  28. 10
      cas/src/test/java/org/springframework/security/cas/authentication/EhCacheBasedTicketCacheTests.java
  29. 2
      cas/src/test/java/org/springframework/security/cas/authentication/NullStatelessTicketCacheTests.java
  30. 6
      cas/src/test/java/org/springframework/security/cas/authentication/SpringCacheBasedTicketCacheTests.java
  31. 6
      cas/src/test/java/org/springframework/security/cas/jackson2/CasAuthenticationTokenMixinTests.java
  32. 2
      cas/src/test/java/org/springframework/security/cas/userdetails/GrantedAuthorityFromAssertionAttributesUserDetailsServiceTests.java
  33. 2
      cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationEntryPointTests.java
  34. 6
      cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationFilterTests.java
  35. 2
      cas/src/test/java/org/springframework/security/cas/web/ServicePropertiesTests.java
  36. 10
      cas/src/test/java/org/springframework/security/cas/web/authentication/DefaultServiceAuthenticationDetailsTests.java
  37. 2
      config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/LdapAuthenticationProviderBuilderSecurityBuilderTests.java
  38. 2
      config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/LdapAuthenticationProviderConfigurerTests.java
  39. 2
      config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/NamespaceLdapAuthenticationProviderTests.java
  40. 16
      config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/HelloRSocketITests.java
  41. 16
      config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/JwtITests.java
  42. 16
      config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerConnectionITests.java
  43. 16
      config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerITests.java
  44. 16
      config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/SimpleAuthenticationITests.java
  45. 6
      config/src/integration-test/java/org/springframework/security/config/ldap/LdapProviderBeanDefinitionParserTests.java
  46. 6
      config/src/integration-test/java/org/springframework/security/config/ldap/LdapServerBeanDefinitionParserTests.java
  47. 6
      config/src/integration-test/java/org/springframework/security/config/ldap/LdapUserServiceBeanDefinitionParserTests.java
  48. 10
      config/src/test/java/org/springframework/security/config/FilterChainProxyConfigTests.java
  49. 6
      config/src/test/java/org/springframework/security/config/InvalidConfigurationTests.java
  50. 8
      config/src/test/java/org/springframework/security/config/SecurityNamespaceHandlerTests.java
  51. 2
      config/src/test/java/org/springframework/security/config/annotation/ObjectPostProcessorTests.java
  52. 2
      config/src/test/java/org/springframework/security/config/annotation/SecurityConfigurerAdapterClosureTests.java
  53. 6
      config/src/test/java/org/springframework/security/config/annotation/SecurityConfigurerAdapterTests.java
  54. 2
      config/src/test/java/org/springframework/security/config/annotation/authentication/AuthenticationManagerBuilderTests.java
  55. 2
      config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceAuthenticationManagerTests.java
  56. 2
      config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceAuthenticationProviderTests.java
  57. 2
      config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceJdbcUserServiceTests.java
  58. 2
      config/src/test/java/org/springframework/security/config/annotation/authentication/NamespacePasswordEncoderTests.java
  59. 2
      config/src/test/java/org/springframework/security/config/annotation/authentication/PasswordEncoderConfigurerTests.java
  60. 8
      config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfigurationPublishTests.java
  61. 6
      config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfigurationTests.java
  62. 2
      config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/EnableGlobalAuthenticationTests.java
  63. 6
      config/src/test/java/org/springframework/security/config/annotation/authentication/configurers/ldap/LdapAuthenticationProviderConfigurerTests.java
  64. 6
      config/src/test/java/org/springframework/security/config/annotation/authentication/configurers/provisioning/UserDetailsManagerConfigurerTests.java
  65. 2
      config/src/test/java/org/springframework/security/config/annotation/configuration/AutowireBeanFactoryObjectPostProcessorTests.java
  66. 16
      config/src/test/java/org/springframework/security/config/annotation/issue50/Issue50Tests.java
  67. 12
      config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java
  68. 8
      config/src/test/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfigurationTests.java
  69. 8
      config/src/test/java/org/springframework/security/config/annotation/method/configuration/NamespaceGlobalMethodSecurityExpressionHandlerTests.java
  70. 8
      config/src/test/java/org/springframework/security/config/annotation/method/configuration/NamespaceGlobalMethodSecurityTests.java
  71. 8
      config/src/test/java/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfigurationTests.java
  72. 2
      config/src/test/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecurityConfigurationTests.java
  73. 6
      config/src/test/java/org/springframework/security/config/annotation/method/configuration/SampleEnableGlobalMethodSecurityTests.java
  74. 8
      config/src/test/java/org/springframework/security/config/annotation/sec2758/Sec2758Tests.java
  75. 6
      config/src/test/java/org/springframework/security/config/annotation/web/AbstractConfiguredSecurityBuilderTests.java
  76. 2
      config/src/test/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistryAnyMatcherTests.java
  77. 6
      config/src/test/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistryTests.java
  78. 12
      config/src/test/java/org/springframework/security/config/annotation/web/HttpSecurityHeadersTests.java
  79. 6
      config/src/test/java/org/springframework/security/config/annotation/web/SampleWebSecurityConfigurerAdapterTests.java
  80. 12
      config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterMockitoTests.java
  81. 2
      config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterTests.java
  82. 2
      config/src/test/java/org/springframework/security/config/annotation/web/builders/FilterOrderRegistrationTests.java
  83. 2
      config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpConfigurationTests.java
  84. 2
      config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpSecurityAddFilterTest.java
  85. 2
      config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpSecurityAuthenticationManagerTests.java
  86. 2
      config/src/test/java/org/springframework/security/config/annotation/web/builders/NamespaceHttpTests.java
  87. 10
      config/src/test/java/org/springframework/security/config/annotation/web/builders/WebSecurityTests.java
  88. 12
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/AuthenticationPrincipalArgumentResolverTests.java
  89. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/EnableWebSecurityTests.java
  90. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/HttpSecurityConfigurationTests.java
  91. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/OAuth2ClientConfigurationTests.java
  92. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/Sec2515Tests.java
  93. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfigurationResourceServerTests.java
  94. 10
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfigurationTests.java
  95. 16
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebMvcSecurityConfigurationTests.java
  96. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.java
  97. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/sec2377/Sec2377Tests.java
  98. 6
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/AbstractConfigAttributeRequestMatcherRegistryTests.java
  99. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/AnonymousConfigurerTests.java
  100. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java
  101. Some files were not shown because too many files have changed in this diff Show More

2
acl/src/test/java/org/springframework/security/acls/AclFormattingUtilsTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.security.acls;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.acls.domain.AclFormattingUtils;
import org.springframework.security.acls.model.Permission;

2
acl/src/test/java/org/springframework/security/acls/AclPermissionCacheOptimizerTests.java

@ -20,7 +20,7 @@ import java.util.Arrays; @@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.acls.domain.ObjectIdentityImpl;
import org.springframework.security.acls.model.AclService;

2
acl/src/test/java/org/springframework/security/acls/AclPermissionEvaluatorTests.java

@ -18,7 +18,7 @@ package org.springframework.security.acls; @@ -18,7 +18,7 @@ package org.springframework.security.acls;
import java.util.Locale;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.acls.model.Acl;
import org.springframework.security.acls.model.AclService;

2
acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationCollectionFilteringProviderTests.java

@ -21,7 +21,7 @@ import java.util.Arrays; @@ -21,7 +21,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.access.SecurityConfig;

2
acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationProviderTests.java

@ -20,7 +20,7 @@ import java.util.Arrays; @@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.ConfigAttribute;

2
acl/src/test/java/org/springframework/security/acls/domain/AccessControlImplEntryTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.security.acls.domain;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.acls.model.AccessControlEntry;
import org.springframework.security.acls.model.Acl;

16
acl/src/test/java/org/springframework/security/acls/domain/AclAuthorizationStrategyImplTests.java

@ -18,12 +18,12 @@ package org.springframework.security.acls.domain; @@ -18,12 +18,12 @@ package org.springframework.security.acls.domain;
import java.util.Arrays;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.security.acls.model.Acl;
import org.springframework.security.authentication.TestingAuthenticationToken;
@ -37,7 +37,7 @@ import static org.mockito.BDDMockito.given; @@ -37,7 +37,7 @@ import static org.mockito.BDDMockito.given;
* @author Rob Winch
*
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class AclAuthorizationStrategyImplTests {
@Mock
@ -47,7 +47,7 @@ public class AclAuthorizationStrategyImplTests { @@ -47,7 +47,7 @@ public class AclAuthorizationStrategyImplTests {
AclAuthorizationStrategyImpl strategy;
@Before
@BeforeEach
public void setup() {
this.authority = new SimpleGrantedAuthority("ROLE_AUTH");
TestingAuthenticationToken authentication = new TestingAuthenticationToken("foo", "bar",
@ -56,7 +56,7 @@ public class AclAuthorizationStrategyImplTests { @@ -56,7 +56,7 @@ public class AclAuthorizationStrategyImplTests {
SecurityContextHolder.getContext().setAuthentication(authentication);
}
@After
@AfterEach
public void cleanup() {
SecurityContextHolder.clearContext();
}

10
acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java

@ -22,9 +22,9 @@ import java.util.Arrays; @@ -22,9 +22,9 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.security.acls.model.AccessControlEntry;
import org.springframework.security.acls.model.Acl;
@ -83,7 +83,7 @@ public class AclImplTests { @@ -83,7 +83,7 @@ public class AclImplTests {
private DefaultPermissionFactory permissionFactory;
@Before
@BeforeEach
public void setUp() {
SecurityContextHolder.getContext().setAuthentication(this.auth);
this.authzStrategy = mock(AclAuthorizationStrategy.class);
@ -93,7 +93,7 @@ public class AclImplTests { @@ -93,7 +93,7 @@ public class AclImplTests {
this.permissionFactory = new DefaultPermissionFactory();
}
@After
@AfterEach
public void tearDown() {
SecurityContextHolder.clearContext();
}

10
acl/src/test/java/org/springframework/security/acls/domain/AclImplementationSecurityCheckTests.java

@ -16,9 +16,9 @@ @@ -16,9 +16,9 @@
package org.springframework.security.acls.domain;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.acls.model.Acl;
@ -43,12 +43,12 @@ public class AclImplementationSecurityCheckTests { @@ -43,12 +43,12 @@ public class AclImplementationSecurityCheckTests {
private static final String TARGET_CLASS = "org.springframework.security.acls.TargetObject";
@Before
@BeforeEach
public void setUp() {
SecurityContextHolder.clearContext();
}
@After
@AfterEach
public void tearDown() {
SecurityContextHolder.clearContext();
}

10
acl/src/test/java/org/springframework/security/acls/domain/AuditLoggerTests.java

@ -19,9 +19,9 @@ package org.springframework.security.acls.domain; @@ -19,9 +19,9 @@ package org.springframework.security.acls.domain;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.security.acls.model.AccessControlEntry;
import org.springframework.security.acls.model.AuditableAccessControlEntry;
@ -45,7 +45,7 @@ public class AuditLoggerTests { @@ -45,7 +45,7 @@ public class AuditLoggerTests {
private AuditableAccessControlEntry ace;
@Before
@BeforeEach
public void setUp() {
this.logger = new ConsoleAuditLogger();
this.ace = mock(AuditableAccessControlEntry.class);
@ -53,7 +53,7 @@ public class AuditLoggerTests { @@ -53,7 +53,7 @@ public class AuditLoggerTests {
System.setOut(new PrintStream(this.bytes));
}
@After
@AfterEach
public void tearDown() {
System.setOut(this.console);
this.bytes.reset();

2
acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityImplTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.security.acls.domain;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.acls.model.ObjectIdentity;

2
acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityRetrievalStrategyImplTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.security.acls.domain;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.acls.model.ObjectIdentity;
import org.springframework.security.acls.model.ObjectIdentityRetrievalStrategy;

6
acl/src/test/java/org/springframework/security/acls/domain/PermissionTests.java

@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
package org.springframework.security.acls.domain;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.security.acls.model.Permission;
@ -32,7 +32,7 @@ public class PermissionTests { @@ -32,7 +32,7 @@ public class PermissionTests {
private DefaultPermissionFactory permissionFactory;
@Before
@BeforeEach
public void createPermissionfactory() {
this.permissionFactory = new DefaultPermissionFactory();
}

20
acl/src/test/java/org/springframework/security/acls/jdbc/AbstractBasicLookupStrategyTests.java

@ -26,11 +26,11 @@ import javax.sql.DataSource; @@ -26,11 +26,11 @@ import javax.sql.DataSource;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Ehcache;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.security.acls.TargetObject;
@ -81,19 +81,19 @@ public abstract class AbstractBasicLookupStrategyTests { @@ -81,19 +81,19 @@ public abstract class AbstractBasicLookupStrategyTests {
public abstract DataSource getDataSource();
@BeforeClass
@BeforeAll
public static void initCacheManaer() {
cacheManager = CacheManager.create();
cacheManager.addCache(new Cache("basiclookuptestcache", 500, false, false, 30, 30));
}
@AfterClass
@AfterAll
public static void shutdownCacheManager() {
cacheManager.removalAll();
cacheManager.shutdown();
}
@Before
@BeforeEach
public void populateDatabase() {
String query = "INSERT INTO acl_sid(ID,PRINCIPAL,SID) VALUES (1,1,'ben');"
+ "INSERT INTO acl_class(ID,CLASS) VALUES (2,'" + TARGET_CLASS + "');"
@ -107,7 +107,7 @@ public abstract class AbstractBasicLookupStrategyTests { @@ -107,7 +107,7 @@ public abstract class AbstractBasicLookupStrategyTests {
getJdbcTemplate().execute(query);
}
@Before
@BeforeEach
public void initializeBeans() {
this.strategy = new BasicLookupStrategy(getDataSource(), aclCache(), aclAuthStrategy(),
new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger()));
@ -123,7 +123,7 @@ public abstract class AbstractBasicLookupStrategyTests { @@ -123,7 +123,7 @@ public abstract class AbstractBasicLookupStrategyTests {
new AclAuthorizationStrategyImpl(new SimpleGrantedAuthority("ROLE_USER")));
}
@After
@AfterEach
public void emptyDatabase() {
String query = "DELETE FROM acl_entry;" + "DELETE FROM acl_object_identity WHERE ID = 9;"
+ "DELETE FROM acl_object_identity WHERE ID = 8;" + "DELETE FROM acl_object_identity WHERE ID = 7;"

12
acl/src/test/java/org/springframework/security/acls/jdbc/AclClassIdUtilsTests.java

@ -22,11 +22,11 @@ import java.sql.ResultSet; @@ -22,11 +22,11 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.core.convert.ConversionService;
@ -39,7 +39,7 @@ import static org.mockito.BDDMockito.given; @@ -39,7 +39,7 @@ import static org.mockito.BDDMockito.given;
*
* @author paulwheeler
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class AclClassIdUtilsTests {
private static final Long DEFAULT_IDENTIFIER = 999L;
@ -56,7 +56,7 @@ public class AclClassIdUtilsTests { @@ -56,7 +56,7 @@ public class AclClassIdUtilsTests {
private AclClassIdUtils aclClassIdUtils;
@Before
@BeforeEach
public void setUp() {
this.aclClassIdUtils = new AclClassIdUtils();
}

8
acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyTests.java

@ -18,8 +18,8 @@ package org.springframework.security.acls.jdbc; @@ -18,8 +18,8 @@ package org.springframework.security.acls.jdbc;
import javax.sql.DataSource;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.springframework.jdbc.core.JdbcTemplate;
@ -33,12 +33,12 @@ public class BasicLookupStrategyTests extends AbstractBasicLookupStrategyTests { @@ -33,12 +33,12 @@ public class BasicLookupStrategyTests extends AbstractBasicLookupStrategyTests {
private static final BasicLookupStrategyTestsDbHelper DATABASE_HELPER = new BasicLookupStrategyTestsDbHelper();
@BeforeClass
@BeforeAll
public static void createDatabase() throws Exception {
DATABASE_HELPER.createDatabase();
}
@AfterClass
@AfterAll
public static void dropDatabase() {
DATABASE_HELPER.getDataSource().destroy();
}

16
acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyWithAclClassTypeTests.java

@ -22,10 +22,10 @@ import java.util.Map; @@ -22,10 +22,10 @@ import java.util.Map;
import javax.sql.DataSource;
import junit.framework.Assert;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.convert.support.DefaultConversionService;
@ -60,18 +60,18 @@ public class BasicLookupStrategyWithAclClassTypeTests extends AbstractBasicLooku @@ -60,18 +60,18 @@ public class BasicLookupStrategyWithAclClassTypeTests extends AbstractBasicLooku
return DATABASE_HELPER.getDataSource();
}
@BeforeClass
@BeforeAll
public static void createDatabase() throws Exception {
DATABASE_HELPER.createDatabase();
}
@AfterClass
@AfterAll
public static void dropDatabase() {
DATABASE_HELPER.getDataSource().destroy();
}
@Override
@Before
@BeforeEach
public void initializeBeans() {
super.initializeBeans();
this.uuidEnabledStrategy = new BasicLookupStrategy(getDataSource(), aclCache(), aclAuthStrategy(),
@ -81,7 +81,7 @@ public class BasicLookupStrategyWithAclClassTypeTests extends AbstractBasicLooku @@ -81,7 +81,7 @@ public class BasicLookupStrategyWithAclClassTypeTests extends AbstractBasicLooku
this.uuidEnabledStrategy.setConversionService(new DefaultConversionService());
}
@Before
@BeforeEach
public void populateDatabaseForAclClassTypeTests() {
String query = "INSERT INTO acl_class(ID,CLASS,CLASS_ID_TYPE) VALUES (3,'" + TARGET_CLASS_WITH_UUID
+ "', 'java.util.UUID');"

16
acl/src/test/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCacheTests.java

@ -26,14 +26,14 @@ import java.util.List; @@ -26,14 +26,14 @@ import java.util.List;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.Element;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.security.acls.domain.AclAuthorizationStrategy;
import org.springframework.security.acls.domain.AclAuthorizationStrategyImpl;
@ -62,7 +62,7 @@ import static org.mockito.Mockito.verify; @@ -62,7 +62,7 @@ import static org.mockito.Mockito.verify;
*
* @author Andrei Stefan
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class EhCacheBasedAclCacheTests {
private static final String TARGET_CLASS = "org.springframework.security.acls.TargetObject";
@ -77,7 +77,7 @@ public class EhCacheBasedAclCacheTests { @@ -77,7 +77,7 @@ public class EhCacheBasedAclCacheTests {
private MutableAcl acl;
@Before
@BeforeEach
public void setup() {
this.myCache = new EhCacheBasedAclCache(this.cache,
new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger()),
@ -89,7 +89,7 @@ public class EhCacheBasedAclCacheTests { @@ -89,7 +89,7 @@ public class EhCacheBasedAclCacheTests {
this.acl = new AclImpl(identity, 1L, aclAuthorizationStrategy, new ConsoleAuditLogger());
}
@After
@AfterEach
public void cleanup() {
SecurityContextHolder.clearContext();
}

18
acl/src/test/java/org/springframework/security/acls/jdbc/JdbcAclServiceTests.java

@ -25,12 +25,12 @@ import java.util.UUID; @@ -25,12 +25,12 @@ import java.util.UUID;
import javax.sql.DataSource;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.RowMapper;
@ -56,7 +56,7 @@ import static org.mockito.BDDMockito.given; @@ -56,7 +56,7 @@ import static org.mockito.BDDMockito.given;
*
* @author Nena Raab
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class JdbcAclServiceTests {
private EmbeddedDatabase embeddedDatabase;
@ -74,13 +74,13 @@ public class JdbcAclServiceTests { @@ -74,13 +74,13 @@ public class JdbcAclServiceTests {
private JdbcAclService aclService;
@Before
@BeforeEach
public void setUp() {
this.aclService = new JdbcAclService(this.jdbcOperations, this.lookupStrategy);
this.aclServiceIntegration = new JdbcAclService(this.embeddedDatabase, this.lookupStrategy);
}
@Before
@BeforeEach
public void setUpEmbeddedDatabase() {
// @formatter:off
this.embeddedDatabase = new EmbeddedDatabaseBuilder()
@ -90,7 +90,7 @@ public class JdbcAclServiceTests { @@ -90,7 +90,7 @@ public class JdbcAclServiceTests {
// @formatter:on
}
@After
@AfterEach
public void tearDownEmbeddedDatabase() {
this.embeddedDatabase.shutdown();
}

2
acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTests.java

@ -22,7 +22,7 @@ import java.util.Map; @@ -22,7 +22,7 @@ import java.util.Map;
import javax.sql.DataSource;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;

2
acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTestsWithAclClassId.java

@ -18,7 +18,7 @@ package org.springframework.security.acls.jdbc; @@ -18,7 +18,7 @@ package org.springframework.security.acls.jdbc;
import java.util.UUID;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.acls.TargetObjectWithUUID;
import org.springframework.security.acls.domain.ObjectIdentityImpl;

10
acl/src/test/java/org/springframework/security/acls/jdbc/SpringCacheBasedAclCacheTests.java

@ -18,9 +18,9 @@ package org.springframework.security.acls.jdbc; @@ -18,9 +18,9 @@ package org.springframework.security.acls.jdbc;
import java.util.Map;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
@ -56,7 +56,7 @@ public class SpringCacheBasedAclCacheTests { @@ -56,7 +56,7 @@ public class SpringCacheBasedAclCacheTests {
private static CacheManager cacheManager;
@BeforeClass
@BeforeAll
public static void initCacheManaer() {
cacheManager = new ConcurrentMapCacheManager();
// Use disk caching immediately (to test for serialization issue reported in
@ -64,7 +64,7 @@ public class SpringCacheBasedAclCacheTests { @@ -64,7 +64,7 @@ public class SpringCacheBasedAclCacheTests {
cacheManager.getCache("springcasebasedacltests");
}
@After
@AfterEach
public void clearContext() {
SecurityContextHolder.clearContext();
}

2
acl/src/test/java/org/springframework/security/acls/sid/SidRetrievalStrategyTests.java

@ -18,7 +18,7 @@ package org.springframework.security.acls.sid; @@ -18,7 +18,7 @@ package org.springframework.security.acls.sid;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.access.hierarchicalroles.RoleHierarchy;
import org.springframework.security.acls.domain.GrantedAuthoritySid;

2
acl/src/test/java/org/springframework/security/acls/sid/SidTests.java

@ -19,7 +19,7 @@ package org.springframework.security.acls.sid; @@ -19,7 +19,7 @@ package org.springframework.security.acls.sid;
import java.util.Collection;
import java.util.Collections;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.acls.domain.GrantedAuthoritySid;
import org.springframework.security.acls.domain.PrincipalSid;

10
aspects/src/test/java/org/springframework/security/access/intercept/aspectj/aspect/AnnotationSecurityAspectTests.java

@ -20,9 +20,9 @@ import java.util.ArrayList; @@ -20,9 +20,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@ -74,7 +74,7 @@ public class AnnotationSecurityAspectTests { @@ -74,7 +74,7 @@ public class AnnotationSecurityAspectTests {
private PrePostSecured prePostSecured = new PrePostSecured();
@Before
@BeforeEach
public final void setUp() {
MockitoAnnotations.initMocks(this);
this.interceptor = new AspectJMethodSecurityInterceptor();
@ -88,7 +88,7 @@ public class AnnotationSecurityAspectTests { @@ -88,7 +88,7 @@ public class AnnotationSecurityAspectTests {
secAspect.setSecurityInterceptor(this.interceptor);
}
@After
@AfterEach
public void clearContext() {
SecurityContextHolder.clearContext();
}

2
cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationProviderTests.java

@ -22,7 +22,7 @@ import java.util.Map; @@ -22,7 +22,7 @@ import java.util.Map;
import org.jasig.cas.client.validation.Assertion;
import org.jasig.cas.client.validation.AssertionImpl;
import org.jasig.cas.client.validation.TicketValidator;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.authentication.BadCredentialsException;

2
cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationTokenTests.java

@ -21,7 +21,7 @@ import java.util.List; @@ -21,7 +21,7 @@ import java.util.List;
import org.jasig.cas.client.validation.Assertion;
import org.jasig.cas.client.validation.AssertionImpl;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

10
cas/src/test/java/org/springframework/security/cas/authentication/EhCacheBasedTicketCacheTests.java

@ -19,9 +19,9 @@ package org.springframework.security.cas.authentication; @@ -19,9 +19,9 @@ package org.springframework.security.cas.authentication;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Ehcache;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
@ -35,13 +35,13 @@ public class EhCacheBasedTicketCacheTests extends AbstractStatelessTicketCacheTe @@ -35,13 +35,13 @@ public class EhCacheBasedTicketCacheTests extends AbstractStatelessTicketCacheTe
private static CacheManager cacheManager;
@BeforeClass
@BeforeAll
public static void initCacheManaer() {
cacheManager = CacheManager.create();
cacheManager.addCache(new Cache("castickets", 500, false, false, 30, 30));
}
@AfterClass
@AfterAll
public static void shutdownCacheManager() {
cacheManager.removalAll();
cacheManager.shutdown();

2
cas/src/test/java/org/springframework/security/cas/authentication/NullStatelessTicketCacheTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.security.cas.authentication;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

6
cas/src/test/java/org/springframework/security/cas/authentication/SpringCacheBasedTicketCacheTests.java

@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
package org.springframework.security.cas.authentication;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.cache.CacheManager;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
@ -36,7 +36,7 @@ public class SpringCacheBasedTicketCacheTests extends AbstractStatelessTicketCac @@ -36,7 +36,7 @@ public class SpringCacheBasedTicketCacheTests extends AbstractStatelessTicketCac
private static CacheManager cacheManager;
@BeforeClass
@BeforeAll
public static void initCacheManaer() {
cacheManager = new ConcurrentMapCacheManager();
cacheManager.getCache("castickets");

6
cas/src/test/java/org/springframework/security/cas/jackson2/CasAuthenticationTokenMixinTests.java

@ -27,8 +27,8 @@ import org.jasig.cas.client.authentication.AttributePrincipalImpl; @@ -27,8 +27,8 @@ import org.jasig.cas.client.authentication.AttributePrincipalImpl;
import org.jasig.cas.client.validation.Assertion;
import org.jasig.cas.client.validation.AssertionImpl;
import org.json.JSONException;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.security.cas.authentication.CasAuthenticationToken;
@ -92,7 +92,7 @@ public class CasAuthenticationTokenMixinTests { @@ -92,7 +92,7 @@ public class CasAuthenticationTokenMixinTests {
protected ObjectMapper mapper;
@Before
@BeforeEach
public void setup() {
this.mapper = new ObjectMapper();
ClassLoader loader = getClass().getClassLoader();

2
cas/src/test/java/org/springframework/security/cas/userdetails/GrantedAuthorityFromAssertionAttributesUserDetailsServiceTests.java

@ -23,7 +23,7 @@ import java.util.Set; @@ -23,7 +23,7 @@ import java.util.Set;
import org.jasig.cas.client.authentication.AttributePrincipal;
import org.jasig.cas.client.validation.Assertion;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.cas.authentication.CasAssertionAuthenticationToken;
import org.springframework.security.core.authority.AuthorityUtils;

2
cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationEntryPointTests.java

@ -18,7 +18,7 @@ package org.springframework.security.cas.web; @@ -18,7 +18,7 @@ package org.springframework.security.cas.web;
import java.net.URLEncoder;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

6
cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationFilterTests.java

@ -19,8 +19,8 @@ package org.springframework.security.cas.web; @@ -19,8 +19,8 @@ package org.springframework.security.cas.web;
import javax.servlet.FilterChain;
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@ -52,7 +52,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; @@ -52,7 +52,7 @@ import static org.mockito.Mockito.verifyZeroInteractions;
*/
public class CasAuthenticationFilterTests {
@After
@AfterEach
public void tearDown() {
SecurityContextHolder.clearContext();
}

2
cas/src/test/java/org/springframework/security/cas/web/ServicePropertiesTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.security.cas.web;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.cas.SamlServiceProperties;
import org.springframework.security.cas.ServiceProperties;

10
cas/src/test/java/org/springframework/security/cas/web/authentication/DefaultServiceAuthenticationDetailsTests.java

@ -18,9 +18,9 @@ package org.springframework.security.cas.web.authentication; @@ -18,9 +18,9 @@ package org.springframework.security.cas.web.authentication;
import java.util.regex.Pattern;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
@ -45,7 +45,7 @@ public class DefaultServiceAuthenticationDetailsTests { @@ -45,7 +45,7 @@ public class DefaultServiceAuthenticationDetailsTests {
private ConfigurableApplicationContext context;
@Before
@BeforeEach
public void setUp() {
this.casServiceUrl = "https://localhost:8443/j_spring_security_cas";
this.request = new MockHttpServletRequest();
@ -57,7 +57,7 @@ public class DefaultServiceAuthenticationDetailsTests { @@ -57,7 +57,7 @@ public class DefaultServiceAuthenticationDetailsTests {
.createArtifactPattern(ServiceProperties.DEFAULT_CAS_ARTIFACT_PARAMETER);
}
@After
@AfterEach
public void cleanup() {
if (this.context != null) {
this.context.close();

2
config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/LdapAuthenticationProviderBuilderSecurityBuilderTests.java

@ -24,7 +24,7 @@ import java.util.List; @@ -24,7 +24,7 @@ import java.util.List;
import javax.naming.directory.SearchControls;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

2
config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/LdapAuthenticationProviderConfigurerTests.java

@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.authentication.ldap; @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.authentication.ldap;
import java.util.Collections;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;

2
config/src/integration-test/java/org/springframework/security/config/annotation/authentication/ldap/NamespaceLdapAuthenticationProviderTests.java

@ -21,7 +21,7 @@ import java.util.HashSet; @@ -21,7 +21,7 @@ import java.util.HashSet;
import java.util.Set;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ldap.core.DirContextOperations;

16
config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/HelloRSocketITests.java

@ -24,10 +24,10 @@ import io.rsocket.exceptions.RejectedSetupException; @@ -24,10 +24,10 @@ import io.rsocket.exceptions.RejectedSetupException;
import io.rsocket.frame.decoder.PayloadDecoder;
import io.rsocket.transport.netty.server.CloseableChannel;
import io.rsocket.transport.netty.server.TcpServerTransport;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@ -44,7 +44,7 @@ import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder; @@ -44,7 +44,7 @@ import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder;
import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata;
import org.springframework.stereotype.Controller;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Rob Winch
*/
@ContextConfiguration
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class HelloRSocketITests {
@Autowired
@ -69,7 +69,7 @@ public class HelloRSocketITests { @@ -69,7 +69,7 @@ public class HelloRSocketITests {
private RSocketRequester requester;
@Before
@BeforeEach
public void setup() {
// @formatter:off
this.server = RSocketServer.create()
@ -83,7 +83,7 @@ public class HelloRSocketITests { @@ -83,7 +83,7 @@ public class HelloRSocketITests {
// @formatter:on
}
@After
@AfterEach
public void dispose() {
this.requester.rsocket().dispose();
this.server.dispose();

16
config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/JwtITests.java

@ -25,10 +25,10 @@ import io.rsocket.frame.decoder.PayloadDecoder; @@ -25,10 +25,10 @@ import io.rsocket.frame.decoder.PayloadDecoder;
import io.rsocket.metadata.WellKnownMimeType;
import io.rsocket.transport.netty.server.CloseableChannel;
import io.rsocket.transport.netty.server.TcpServerTransport;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
@ -49,7 +49,7 @@ import org.springframework.security.rsocket.metadata.BearerTokenAuthenticationEn @@ -49,7 +49,7 @@ import org.springframework.security.rsocket.metadata.BearerTokenAuthenticationEn
import org.springframework.security.rsocket.metadata.BearerTokenMetadata;
import org.springframework.stereotype.Controller;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.util.MimeType;
import org.springframework.util.MimeTypeUtils;
@ -62,7 +62,7 @@ import static org.mockito.Mockito.mock; @@ -62,7 +62,7 @@ import static org.mockito.Mockito.mock;
* @author Rob Winch
*/
@ContextConfiguration
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class JwtITests {
@Autowired
@ -81,7 +81,7 @@ public class JwtITests { @@ -81,7 +81,7 @@ public class JwtITests {
private RSocketRequester requester;
@Before
@BeforeEach
public void setup() {
// @formatter:off
this.server = RSocketServer.create()
@ -95,7 +95,7 @@ public class JwtITests { @@ -95,7 +95,7 @@ public class JwtITests {
// @formatter:on
}
@After
@AfterEach
public void dispose() {
this.requester.rsocket().dispose();
this.server.dispose();

16
config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerConnectionITests.java

@ -25,10 +25,10 @@ import io.rsocket.exceptions.RejectedSetupException; @@ -25,10 +25,10 @@ import io.rsocket.exceptions.RejectedSetupException;
import io.rsocket.frame.decoder.PayloadDecoder;
import io.rsocket.transport.netty.server.CloseableChannel;
import io.rsocket.transport.netty.server.TcpServerTransport;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@ -47,7 +47,7 @@ import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder; @@ -47,7 +47,7 @@ import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder;
import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata;
import org.springframework.stereotype.Controller;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@ -60,7 +60,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -60,7 +60,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Ebert Toribio
*/
@ContextConfiguration
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class RSocketMessageHandlerConnectionITests {
@Autowired
@ -76,7 +76,7 @@ public class RSocketMessageHandlerConnectionITests { @@ -76,7 +76,7 @@ public class RSocketMessageHandlerConnectionITests {
private RSocketRequester requester;
@Before
@BeforeEach
public void setup() {
// @formatter:off
this.server = RSocketServer.create()
@ -90,7 +90,7 @@ public class RSocketMessageHandlerConnectionITests { @@ -90,7 +90,7 @@ public class RSocketMessageHandlerConnectionITests {
// @formatter:on
}
@After
@AfterEach
public void dispose() {
this.requester.rsocket().dispose();
this.server.dispose();

16
config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/RSocketMessageHandlerITests.java

@ -25,10 +25,10 @@ import io.rsocket.exceptions.ApplicationErrorException; @@ -25,10 +25,10 @@ import io.rsocket.exceptions.ApplicationErrorException;
import io.rsocket.frame.decoder.PayloadDecoder;
import io.rsocket.transport.netty.server.CloseableChannel;
import io.rsocket.transport.netty.server.TcpServerTransport;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@ -49,7 +49,7 @@ import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder; @@ -49,7 +49,7 @@ import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder;
import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata;
import org.springframework.stereotype.Controller;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@ -58,7 +58,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -58,7 +58,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Rob Winch
*/
@ContextConfiguration
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class RSocketMessageHandlerITests {
@Autowired
@ -74,7 +74,7 @@ public class RSocketMessageHandlerITests { @@ -74,7 +74,7 @@ public class RSocketMessageHandlerITests {
private RSocketRequester requester;
@Before
@BeforeEach
public void setup() {
// @formatter:off
this.server = RSocketServer.create()
@ -94,7 +94,7 @@ public class RSocketMessageHandlerITests { @@ -94,7 +94,7 @@ public class RSocketMessageHandlerITests {
// @formatter:on
}
@After
@AfterEach
public void dispose() {
this.requester.rsocket().dispose();
this.server.dispose();

16
config/src/integration-test/java/org/springframework/security/config/annotation/rsocket/SimpleAuthenticationITests.java

@ -25,10 +25,10 @@ import io.rsocket.frame.decoder.PayloadDecoder; @@ -25,10 +25,10 @@ import io.rsocket.frame.decoder.PayloadDecoder;
import io.rsocket.metadata.WellKnownMimeType;
import io.rsocket.transport.netty.server.CloseableChannel;
import io.rsocket.transport.netty.server.TcpServerTransport;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@ -47,7 +47,7 @@ import org.springframework.security.rsocket.metadata.SimpleAuthenticationEncoder @@ -47,7 +47,7 @@ import org.springframework.security.rsocket.metadata.SimpleAuthenticationEncoder
import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata;
import org.springframework.stereotype.Controller;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.util.MimeType;
import org.springframework.util.MimeTypeUtils;
@ -58,7 +58,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -58,7 +58,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Rob Winch
*/
@ContextConfiguration
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
public class SimpleAuthenticationITests {
@Autowired
@ -74,7 +74,7 @@ public class SimpleAuthenticationITests { @@ -74,7 +74,7 @@ public class SimpleAuthenticationITests {
private RSocketRequester requester;
@Before
@BeforeEach
public void setup() {
// @formatter:off
this.server = RSocketServer.create()
@ -88,7 +88,7 @@ public class SimpleAuthenticationITests { @@ -88,7 +88,7 @@ public class SimpleAuthenticationITests {
// @formatter:on
}
@After
@AfterEach
public void dispose() {
this.requester.rsocket().dispose();
this.server.dispose();

6
config/src/integration-test/java/org/springframework/security/config/ldap/LdapProviderBeanDefinitionParserTests.java

@ -18,8 +18,8 @@ package org.springframework.security.config.ldap; @@ -18,8 +18,8 @@ package org.springframework.security.config.ldap;
import java.text.MessageFormat;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContextException;
import org.springframework.security.authentication.AuthenticationManager;
@ -39,7 +39,7 @@ public class LdapProviderBeanDefinitionParserTests { @@ -39,7 +39,7 @@ public class LdapProviderBeanDefinitionParserTests {
InMemoryXmlApplicationContext appCtx;
@After
@AfterEach
public void closeAppContext() {
if (this.appCtx != null) {
this.appCtx.close();

6
config/src/integration-test/java/org/springframework/security/config/ldap/LdapServerBeanDefinitionParserTests.java

@ -19,8 +19,8 @@ package org.springframework.security.config.ldap; @@ -19,8 +19,8 @@ package org.springframework.security.config.ldap;
import java.io.IOException;
import java.net.ServerSocket;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.security.config.BeanIds;
@ -39,7 +39,7 @@ public class LdapServerBeanDefinitionParserTests { @@ -39,7 +39,7 @@ public class LdapServerBeanDefinitionParserTests {
InMemoryXmlApplicationContext appCtx;
@After
@AfterEach
public void closeAppContext() {
if (this.appCtx != null) {
this.appCtx.close();

6
config/src/integration-test/java/org/springframework/security/config/ldap/LdapUserServiceBeanDefinitionParserTests.java

@ -18,8 +18,8 @@ package org.springframework.security.config.ldap; @@ -18,8 +18,8 @@ package org.springframework.security.config.ldap;
import java.util.Set;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Element;
import org.springframework.security.config.util.InMemoryXmlApplicationContext;
@ -47,7 +47,7 @@ public class LdapUserServiceBeanDefinitionParserTests { @@ -47,7 +47,7 @@ public class LdapUserServiceBeanDefinitionParserTests {
private InMemoryXmlApplicationContext appCtx;
@After
@AfterEach
public void closeAppContext() {
if (this.appCtx != null) {
this.appCtx.close();

10
config/src/test/java/org/springframework/security/config/FilterChainProxyConfigTests.java

@ -23,9 +23,9 @@ import javax.servlet.FilterChain; @@ -23,9 +23,9 @@ import javax.servlet.FilterChain;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.mock.web.MockHttpServletRequest;
@ -55,14 +55,14 @@ public class FilterChainProxyConfigTests { @@ -55,14 +55,14 @@ public class FilterChainProxyConfigTests {
private ClassPathXmlApplicationContext appCtx;
@Before
@BeforeEach
public void loadContext() {
System.setProperty("sec1235.pattern1", "/login");
System.setProperty("sec1235.pattern2", "/logout");
this.appCtx = new ClassPathXmlApplicationContext("org/springframework/security/util/filtertest-valid.xml");
}
@After
@AfterEach
public void closeContext() {
if (this.appCtx != null) {
this.appCtx.close();

6
config/src/test/java/org/springframework/security/config/InvalidConfigurationTests.java

@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
package org.springframework.security.config;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
@ -39,7 +39,7 @@ public class InvalidConfigurationTests { @@ -39,7 +39,7 @@ public class InvalidConfigurationTests {
private InMemoryXmlApplicationContext appContext;
@After
@AfterEach
public void closeAppContext() {
if (this.appContext != null) {
this.appContext.close();

8
config/src/test/java/org/springframework/security/config/SecurityNamespaceHandlerTests.java

@ -17,12 +17,12 @@ @@ -17,12 +17,12 @@
package org.springframework.security.config;
import org.apache.commons.logging.Log;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.MockedStatic;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.security.config.util.InMemoryXmlApplicationContext;
@ -40,7 +40,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; @@ -40,7 +40,7 @@ import static org.mockito.Mockito.verifyZeroInteractions;
* @author Rob Winch
* @since 3.0
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class SecurityNamespaceHandlerTests {
// @formatter:off

2
config/src/test/java/org/springframework/security/config/annotation/ObjectPostProcessorTests.java

@ -20,7 +20,7 @@ import java.util.ArrayList; @@ -20,7 +20,7 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThatObject;

2
config/src/test/java/org/springframework/security/config/annotation/SecurityConfigurerAdapterClosureTests.java

@ -19,7 +19,7 @@ package org.springframework.security.config.annotation; @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

6
config/src/test/java/org/springframework/security/config/annotation/SecurityConfigurerAdapterTests.java

@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
package org.springframework.security.config.annotation;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.Ordered;
@ -27,7 +27,7 @@ public class SecurityConfigurerAdapterTests { @@ -27,7 +27,7 @@ public class SecurityConfigurerAdapterTests {
ConcereteSecurityConfigurerAdapter adapter;
@Before
@BeforeEach
public void setup() {
this.adapter = new ConcereteSecurityConfigurerAdapter();
}

2
config/src/test/java/org/springframework/security/config/annotation/authentication/AuthenticationManagerBuilderTests.java

@ -20,7 +20,7 @@ import java.util.Arrays; @@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.Properties;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

2
config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceAuthenticationManagerTests.java

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.authentication;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;

2
config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceAuthenticationProviderTests.java

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.authentication;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

2
config/src/test/java/org/springframework/security/config/annotation/authentication/NamespaceJdbcUserServiceTests.java

@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.authentication; @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.authentication;
import javax.sql.DataSource;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

2
config/src/test/java/org/springframework/security/config/annotation/authentication/NamespacePasswordEncoderTests.java

@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.authentication; @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.authentication;
import javax.sql.DataSource;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

2
config/src/test/java/org/springframework/security/config/annotation/authentication/PasswordEncoderConfigurerTests.java

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.authentication;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

8
config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfigurationPublishTests.java

@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
package org.springframework.security.config.annotation.authentication.configuration;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@ -29,14 +29,14 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio @@ -29,14 +29,14 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import org.springframework.security.authentication.event.AuthenticationSuccessEvent;
import org.springframework.security.config.MockEventListener;
import org.springframework.security.config.users.AuthenticationTestConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Rob Winch
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
public class AuthenticationConfigurationPublishTests {
@Autowired

6
config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfigurationTests.java

@ -20,9 +20,9 @@ import java.util.ArrayList; @@ -20,9 +20,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.ProxyFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
@ -79,7 +79,7 @@ public class AuthenticationConfigurationTests { @@ -79,7 +79,7 @@ public class AuthenticationConfigurationTests {
@Autowired(required = false)
private Service service;
@After
@AfterEach
public void cleanup() {
SecurityContextHolder.clearContext();
}

2
config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/EnableGlobalAuthenticationTests.java

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.authentication.configuration;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

6
config/src/test/java/org/springframework/security/config/annotation/authentication/configurers/ldap/LdapAuthenticationProviderConfigurerTests.java

@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
package org.springframework.security.config.annotation.authentication.configurers.ldap;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.core.authority.mapping.NullAuthoritiesMapper;
@ -29,7 +29,7 @@ public class LdapAuthenticationProviderConfigurerTests { @@ -29,7 +29,7 @@ public class LdapAuthenticationProviderConfigurerTests {
private LdapAuthenticationProviderConfigurer<AuthenticationManagerBuilder> configurer;
@Before
@BeforeEach
public void setUp() {
this.configurer = new LdapAuthenticationProviderConfigurer<>();
}

6
config/src/test/java/org/springframework/security/config/annotation/authentication/configurers/provisioning/UserDetailsManagerConfigurerTests.java

@ -18,8 +18,8 @@ package org.springframework.security.config.annotation.authentication.configurer @@ -18,8 +18,8 @@ package org.springframework.security.config.annotation.authentication.configurer
import java.util.Arrays;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
@ -36,7 +36,7 @@ public class UserDetailsManagerConfigurerTests { @@ -36,7 +36,7 @@ public class UserDetailsManagerConfigurerTests {
private InMemoryUserDetailsManager userDetailsManager;
@Before
@BeforeEach
public void setup() {
this.userDetailsManager = new InMemoryUserDetailsManager();
}

2
config/src/test/java/org/springframework/security/config/annotation/configuration/AutowireBeanFactoryObjectPostProcessorTests.java

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.configuration;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.BeanFactoryAware;

16
config/src/test/java/org/springframework/security/config/annotation/issue50/Issue50Tests.java

@ -18,10 +18,10 @@ package org.springframework.security.config.annotation.issue50; @@ -18,10 +18,10 @@ package org.springframework.security.config.annotation.issue50;
import javax.transaction.Transactional;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.AccessDeniedException;
@ -35,7 +35,7 @@ import org.springframework.security.core.Authentication; @@ -35,7 +35,7 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
*
*/
@Transactional
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = { ApplicationConfig.class, SecurityConfig.class })
public class Issue50Tests {
@ -55,13 +55,13 @@ public class Issue50Tests { @@ -55,13 +55,13 @@ public class Issue50Tests {
@Autowired
private UserRepository userRepo;
@Before
@BeforeEach
public void setup() {
SecurityContextHolder.getContext()
.setAuthentication(new TestingAuthenticationToken("test", null, "ROLE_ADMIN"));
}
@After
@AfterEach
public void cleanup() {
SecurityContextHolder.clearContext();
}

12
config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java

@ -16,9 +16,9 @@ @@ -16,9 +16,9 @@
package org.springframework.security.config.annotation.method.configuration;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@ -32,7 +32,7 @@ import org.springframework.security.access.AccessDeniedException; @@ -32,7 +32,7 @@ import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.authentication.TestingAuthenticationToken;
import org.springframework.security.core.context.ReactiveSecurityContextHolder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
@ -44,7 +44,7 @@ import static org.mockito.Mockito.reset; @@ -44,7 +44,7 @@ import static org.mockito.Mockito.reset;
* @author Rob Winch
* @since 5.0
*/
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
@ContextConfiguration
public class EnableReactiveMethodSecurityTests {
@ -61,7 +61,7 @@ public class EnableReactiveMethodSecurityTests { @@ -61,7 +61,7 @@ public class EnableReactiveMethodSecurityTests {
Context withUser = ReactiveSecurityContextHolder
.withAuthentication(new TestingAuthenticationToken("user", "password", "ROLE_USER"));
@After
@AfterEach
public void cleanup() {
reset(this.delegate);
}

8
config/src/test/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfigurationTests.java

@ -24,8 +24,8 @@ import javax.sql.DataSource; @@ -24,8 +24,8 @@ import javax.sql.DataSource;
import org.aopalliance.intercept.MethodInterceptor;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.UnsatisfiedDependencyException;
@ -56,7 +56,7 @@ import org.springframework.security.config.test.SpringTestRule; @@ -56,7 +56,7 @@ import org.springframework.security.config.test.SpringTestRule;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
@ -73,7 +73,7 @@ import static org.mockito.Mockito.verify; @@ -73,7 +73,7 @@ import static org.mockito.Mockito.verify;
* @author Rob Winch
* @author Artsiom Yudovin
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@SecurityTestExecutionListeners
public class GlobalMethodSecurityConfigurationTests {

8
config/src/test/java/org/springframework/security/config/annotation/method/configuration/NamespaceGlobalMethodSecurityExpressionHandlerTests.java

@ -19,8 +19,8 @@ package org.springframework.security.config.annotation.method.configuration; @@ -19,8 +19,8 @@ package org.springframework.security.config.annotation.method.configuration;
import java.io.Serializable;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.AccessDeniedException;
@ -31,7 +31,7 @@ import org.springframework.security.config.test.SpringTestRule; @@ -31,7 +31,7 @@ import org.springframework.security.config.test.SpringTestRule;
import org.springframework.security.core.Authentication;
import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Rob Winch
* @author Josh Cummings
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@SecurityTestExecutionListeners
public class NamespaceGlobalMethodSecurityExpressionHandlerTests {

8
config/src/test/java/org/springframework/security/config/annotation/method/configuration/NamespaceGlobalMethodSecurityTests.java

@ -24,8 +24,8 @@ import java.util.Collections; @@ -24,8 +24,8 @@ import java.util.Collections;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
@ -54,7 +54,7 @@ import org.springframework.security.config.test.SpringTestRule; @@ -54,7 +54,7 @@ import org.springframework.security.config.test.SpringTestRule;
import org.springframework.security.core.Authentication;
import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@ -63,7 +63,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -63,7 +63,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Rob Winch
* @author Josh Cummings
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@SecurityTestExecutionListeners
public class NamespaceGlobalMethodSecurityTests {

8
config/src/test/java/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfigurationTests.java

@ -24,8 +24,8 @@ import java.util.List; @@ -24,8 +24,8 @@ import java.util.List;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.aop.Advisor;
import org.springframework.aop.support.DefaultPointcutAdvisor;
@ -54,7 +54,7 @@ import org.springframework.security.core.context.SecurityContextHolder; @@ -54,7 +54,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners;
import org.springframework.security.test.context.support.WithAnonymousUser;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@ -65,7 +65,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -65,7 +65,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Evgeniy Cheban
* @author Josh Cummings
*/
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
@SecurityTestExecutionListeners
public class PrePostMethodSecurityConfigurationTests {

2
config/src/test/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecurityConfigurationTests.java

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.method.configuration;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

6
config/src/test/java/org/springframework/security/config/annotation/method/configuration/SampleEnableGlobalMethodSecurityTests.java

@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.method.configuration; @@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.method.configuration;
import java.io.Serializable;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@ -51,7 +51,7 @@ public class SampleEnableGlobalMethodSecurityTests { @@ -51,7 +51,7 @@ public class SampleEnableGlobalMethodSecurityTests {
@Autowired
private MethodSecurityService methodSecurityService;
@Before
@BeforeEach
public void setup() {
SecurityContextHolder.getContext()
.setAuthentication(new TestingAuthenticationToken("user", "password", "ROLE_USER"));

8
config/src/test/java/org/springframework/security/config/annotation/sec2758/Sec2758Tests.java

@ -19,8 +19,8 @@ package org.springframework.security.config.annotation.sec2758; @@ -19,8 +19,8 @@ package org.springframework.security.config.annotation.sec2758;
import javax.annotation.security.RolesAllowed;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
@ -39,7 +39,7 @@ import org.springframework.security.config.test.SpringTestRule; @@ -39,7 +39,7 @@ import org.springframework.security.config.test.SpringTestRule;
import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@ -51,7 +51,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @@ -51,7 +51,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
* @author Josh Cummings
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@SecurityTestExecutionListeners
public class Sec2758Tests {

6
config/src/test/java/org/springframework/security/config/annotation/web/AbstractConfiguredSecurityBuilderTests.java

@ -18,8 +18,8 @@ package org.springframework.security.config.annotation.web; @@ -18,8 +18,8 @@ package org.springframework.security.config.annotation.web;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder;
import org.springframework.security.config.annotation.ObjectPostProcessor;
@ -41,7 +41,7 @@ public class AbstractConfiguredSecurityBuilderTests { @@ -41,7 +41,7 @@ public class AbstractConfiguredSecurityBuilderTests {
private TestConfiguredSecurityBuilder builder;
@Before
@BeforeEach
public void setUp() {
this.builder = new TestConfiguredSecurityBuilder(mock(ObjectPostProcessor.class));
}

2
config/src/test/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistryAnyMatcherTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.security.config.annotation.web;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.mock.web.MockServletContext;

6
config/src/test/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistryTests.java

@ -20,8 +20,8 @@ import java.util.List; @@ -20,8 +20,8 @@ import java.util.List;
import javax.servlet.DispatcherType;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpMethod;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
@ -40,7 +40,7 @@ public class AbstractRequestMatcherRegistryTests { @@ -40,7 +40,7 @@ public class AbstractRequestMatcherRegistryTests {
private TestRequestMatcherRegistry matcherRegistry;
@Before
@BeforeEach
public void setUp() {
this.matcherRegistry = new TestRequestMatcherRegistry();
}

12
config/src/test/java/org/springframework/security/config/annotation/web/HttpSecurityHeadersTests.java

@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.web; @@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.web;
import javax.servlet.Filter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@ -29,7 +29,7 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -29,7 +29,7 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
@ -46,7 +46,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @@ -46,7 +46,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
* @author Rob Winch
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@ContextConfiguration
@WebAppConfiguration
public class HttpSecurityHeadersTests {
@ -59,7 +59,7 @@ public class HttpSecurityHeadersTests { @@ -59,7 +59,7 @@ public class HttpSecurityHeadersTests {
MockMvc mockMvc;
@Before
@BeforeEach
public void setup() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).addFilters(this.springSecurityFilterChain).build();
}

6
config/src/test/java/org/springframework/security/config/annotation/web/SampleWebSecurityConfigurerAdapterTests.java

@ -20,9 +20,9 @@ import java.util.Base64; @@ -20,9 +20,9 @@ import java.util.Base64;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@ -64,7 +64,7 @@ public class SampleWebSecurityConfigurerAdapterTests { @@ -64,7 +64,7 @@ public class SampleWebSecurityConfigurerAdapterTests {
private MockFilterChain chain;
@Before
@BeforeEach
public void setup() {
this.request = new MockHttpServletRequest("GET", "");
this.response = new MockHttpServletResponse();

12
config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterMockitoTests.java

@ -18,14 +18,14 @@ package org.springframework.security.config.annotation.web; @@ -18,14 +18,14 @@ package org.springframework.security.config.annotation.web;
import java.util.Arrays;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockedStatic;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.support.SpringFactoriesLoader;
@ -55,7 +55,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder @@ -55,7 +55,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
* @author Rob Winch
*
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class WebSecurityConfigurerAdapterMockitoTests {
ConfigurableWebApplicationContext context;
@ -69,7 +69,7 @@ public class WebSecurityConfigurerAdapterMockitoTests { @@ -69,7 +69,7 @@ public class WebSecurityConfigurerAdapterMockitoTests {
@Mock
private MockedStatic<SpringFactoriesLoader> springFactoriesLoader;
@After
@AfterEach
public void close() {
if (this.context != null) {
this.context.close();

2
config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterTests.java

@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletRequest; @@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

2
config/src/test/java/org/springframework/security/config/annotation/web/builders/FilterOrderRegistrationTests.java

@ -24,7 +24,7 @@ import javax.servlet.ServletException; @@ -24,7 +24,7 @@ import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.web.access.channel.ChannelProcessingFilter;

2
config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpConfigurationTests.java

@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletRequest; @@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;

2
config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpSecurityAddFilterTest.java

@ -28,7 +28,7 @@ import javax.servlet.ServletResponse; @@ -28,7 +28,7 @@ import javax.servlet.ServletResponse;
import org.assertj.core.api.ListAssert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;

2
config/src/test/java/org/springframework/security/config/annotation/web/builders/HttpSecurityAuthenticationManagerTests.java

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.web.builders;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;

2
config/src/test/java/org/springframework/security/config/annotation/web/builders/NamespaceHttpTests.java

@ -22,7 +22,7 @@ import javax.servlet.http.HttpServletRequest; @@ -22,7 +22,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.AccessDecisionManager;

10
config/src/test/java/org/springframework/security/config/annotation/web/builders/WebSecurityTests.java

@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.web.builders; @@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.web.builders;
import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@ -57,7 +57,7 @@ public class WebSecurityTests { @@ -57,7 +57,7 @@ public class WebSecurityTests {
@Autowired
FilterChainProxy springSecurityFilterChain;
@Before
@BeforeEach
public void setup() {
this.request = new MockHttpServletRequest("GET", "");
this.request.setMethod("GET");
@ -65,7 +65,7 @@ public class WebSecurityTests { @@ -65,7 +65,7 @@ public class WebSecurityTests {
this.chain = new MockFilterChain();
}
@After
@AfterEach
public void cleanup() {
if (this.context != null) {
this.context.close();

12
config/src/test/java/org/springframework/security/config/annotation/web/configuration/AuthenticationPrincipalArgumentResolverTests.java

@ -16,9 +16,9 @@ @@ -16,9 +16,9 @@
package org.springframework.security.config.annotation.web.configuration;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@ -30,7 +30,7 @@ import org.springframework.security.core.context.SecurityContext; @@ -30,7 +30,7 @@ import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
@ -47,7 +47,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @@ -47,7 +47,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
* @author Rob Winch
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@ContextConfiguration
@WebAppConfiguration
public class AuthenticationPrincipalArgumentResolverTests {
@ -55,7 +55,7 @@ public class AuthenticationPrincipalArgumentResolverTests { @@ -55,7 +55,7 @@ public class AuthenticationPrincipalArgumentResolverTests {
@Autowired
WebApplicationContext wac;
@After
@AfterEach
public void cleanup() {
SecurityContextHolder.clearContext();
}

2
config/src/test/java/org/springframework/security/config/annotation/web/configuration/EnableWebSecurityTests.java

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.web.configuration;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

2
config/src/test/java/org/springframework/security/config/annotation/web/configuration/HttpSecurityConfigurationTests.java

@ -22,7 +22,7 @@ import javax.servlet.http.HttpServletRequest; @@ -22,7 +22,7 @@ import javax.servlet.http.HttpServletRequest;
import com.google.common.net.HttpHeaders;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

2
config/src/test/java/org/springframework/security/config/annotation/web/configuration/OAuth2ClientConfigurationTests.java

@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.web.configuration; @@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.web.configuration;
import javax.servlet.http.HttpServletRequest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;

2
config/src/test/java/org/springframework/security/config/annotation/web/configuration/Sec2515Tests.java

@ -20,7 +20,7 @@ import java.net.URL; @@ -20,7 +20,7 @@ import java.net.URL;
import java.net.URLClassLoader;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.FatalBeanException;
import org.springframework.context.annotation.Bean;

2
config/src/test/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfigurationResourceServerTests.java

@ -24,7 +24,7 @@ import okhttp3.mockwebserver.MockWebServer; @@ -24,7 +24,7 @@ import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;
import org.apache.commons.lang.StringUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

10
config/src/test/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfigurationTests.java

@ -23,10 +23,10 @@ import java.util.Map; @@ -23,10 +23,10 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import reactor.core.CoreSubscriber;
import reactor.core.publisher.BaseSubscriber;
import reactor.core.publisher.Mono;
@ -74,14 +74,14 @@ public class SecurityReactorContextConfigurationTests { @@ -74,14 +74,14 @@ public class SecurityReactorContextConfigurationTests {
@Rule
public final SpringTestRule spring = new SpringTestRule();
@Before
@BeforeEach
public void setup() {
this.servletRequest = new MockHttpServletRequest();
this.servletResponse = new MockHttpServletResponse();
this.authentication = new TestingAuthenticationToken("principal", "password");
}
@After
@AfterEach
public void cleanup() {
SecurityContextHolder.clearContext();
RequestContextHolder.resetRequestAttributes();

16
config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebMvcSecurityConfigurationTests.java

@ -16,10 +16,10 @@ @@ -16,10 +16,10 @@
package org.springframework.security.config.annotation.web.configuration;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@ -33,7 +33,7 @@ import org.springframework.security.web.csrf.CsrfToken; @@ -33,7 +33,7 @@ import org.springframework.security.web.csrf.CsrfToken;
import org.springframework.security.web.csrf.DefaultCsrfToken;
import org.springframework.stereotype.Controller;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultMatcher;
@ -51,7 +51,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @@ -51,7 +51,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
/**
* @author Rob Winch
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@ContextConfiguration
@WebAppConfiguration
public class WebMvcSecurityConfigurationTests {
@ -63,7 +63,7 @@ public class WebMvcSecurityConfigurationTests { @@ -63,7 +63,7 @@ public class WebMvcSecurityConfigurationTests {
Authentication authentication;
@Before
@BeforeEach
public void setup() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build();
this.authentication = new TestingAuthenticationToken("user", "password",
@ -71,7 +71,7 @@ public class WebMvcSecurityConfigurationTests { @@ -71,7 +71,7 @@ public class WebMvcSecurityConfigurationTests {
SecurityContextHolder.getContext().setAuthentication(this.authentication);
}
@After
@AfterEach
public void cleanup() {
SecurityContextHolder.clearContext();
}

2
config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.java

@ -26,7 +26,7 @@ import javax.servlet.Filter; @@ -26,7 +26,7 @@ import javax.servlet.Filter;
import javax.servlet.http.HttpServletRequest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;

2
config/src/test/java/org/springframework/security/config/annotation/web/configuration/sec2377/Sec2377Tests.java

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.web.configuration.sec2377;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.security.config.annotation.web.configuration.sec2377.a.Sec2377AConfig;

6
config/src/test/java/org/springframework/security/config/annotation/web/configurers/AbstractConfigAttributeRequestMatcherRegistryTests.java

@ -18,8 +18,8 @@ package org.springframework.security.config.annotation.web.configurers; @@ -18,8 +18,8 @@ package org.springframework.security.config.annotation.web.configurers;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpMethod;
import org.springframework.security.access.AccessDecisionVoter;
@ -33,7 +33,7 @@ public class AbstractConfigAttributeRequestMatcherRegistryTests { @@ -33,7 +33,7 @@ public class AbstractConfigAttributeRequestMatcherRegistryTests {
private ConcreteAbstractRequestMatcherMappingConfigurer registry;
@Before
@BeforeEach
public void setup() {
this.registry = new ConcreteAbstractRequestMatcherMappingConfigurer();
}

2
config/src/test/java/org/springframework/security/config/annotation/web/configurers/AnonymousConfigurerTests.java

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.web.configurers;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;

2
config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.web.configurers;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save