openrewrite Junit Migration

This commit is contained in:
Rob Winch 2021-07-08 14:52:28 -05:00
parent 8652f01269
commit 3e93b024d6
999 changed files with 3088 additions and 3092 deletions

View File

@ -16,7 +16,7 @@
package org.springframework.security.acls; 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.domain.AclFormattingUtils;
import org.springframework.security.acls.model.Permission; import org.springframework.security.acls.model.Permission;

View File

@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; 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.domain.ObjectIdentityImpl;
import org.springframework.security.acls.model.AclService; import org.springframework.security.acls.model.AclService;

View File

@ -18,7 +18,7 @@ package org.springframework.security.acls;
import java.util.Locale; 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.Acl;
import org.springframework.security.acls.model.AclService; import org.springframework.security.acls.model.AclService;

View File

@ -21,7 +21,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; 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.ConfigAttribute;
import org.springframework.security.access.SecurityConfig; import org.springframework.security.access.SecurityConfig;

View File

@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; 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.AccessDeniedException;
import org.springframework.security.access.ConfigAttribute; import org.springframework.security.access.ConfigAttribute;

View File

@ -16,7 +16,7 @@
package org.springframework.security.acls.domain; 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.AccessControlEntry;
import org.springframework.security.acls.model.Acl; import org.springframework.security.acls.model.Acl;

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@
package org.springframework.security.acls.domain; 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.ObjectIdentity;

View File

@ -16,7 +16,7 @@
package org.springframework.security.acls.domain; 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.ObjectIdentity;
import org.springframework.security.acls.model.ObjectIdentityRetrievalStrategy; import org.springframework.security.acls.model.ObjectIdentityRetrievalStrategy;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@ package org.springframework.security.acls.jdbc;
import java.util.UUID; 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.TargetObjectWithUUID;
import org.springframework.security.acls.domain.ObjectIdentityImpl; import org.springframework.security.acls.domain.ObjectIdentityImpl;

View File

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

View File

@ -18,7 +18,7 @@ package org.springframework.security.acls.sid;
import java.util.List; 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.access.hierarchicalroles.RoleHierarchy;
import org.springframework.security.acls.domain.GrantedAuthoritySid; import org.springframework.security.acls.domain.GrantedAuthoritySid;

View File

@ -19,7 +19,7 @@ package org.springframework.security.acls.sid;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; 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.GrantedAuthoritySid;
import org.springframework.security.acls.domain.PrincipalSid; import org.springframework.security.acls.domain.PrincipalSid;

View File

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

View File

@ -22,7 +22,7 @@ import java.util.Map;
import org.jasig.cas.client.validation.Assertion; import org.jasig.cas.client.validation.Assertion;
import org.jasig.cas.client.validation.AssertionImpl; import org.jasig.cas.client.validation.AssertionImpl;
import org.jasig.cas.client.validation.TicketValidator; 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.mock.web.MockHttpServletRequest;
import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.BadCredentialsException;

View File

@ -21,7 +21,7 @@ import java.util.List;
import org.jasig.cas.client.validation.Assertion; import org.jasig.cas.client.validation.Assertion;
import org.jasig.cas.client.validation.AssertionImpl; 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.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ import java.util.Set;
import org.jasig.cas.client.authentication.AttributePrincipal; import org.jasig.cas.client.authentication.AttributePrincipal;
import org.jasig.cas.client.validation.Assertion; 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.cas.authentication.CasAssertionAuthenticationToken;
import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.authority.AuthorityUtils;

View File

@ -18,7 +18,7 @@ package org.springframework.security.cas.web;
import java.net.URLEncoder; 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.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockHttpServletResponse;

View File

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

View File

@ -16,7 +16,7 @@
package org.springframework.security.cas.web; 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.SamlServiceProperties;
import org.springframework.security.cas.ServiceProperties; import org.springframework.security.cas.ServiceProperties;

View File

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

View File

@ -24,7 +24,7 @@ import java.util.List;
import javax.naming.directory.SearchControls; import javax.naming.directory.SearchControls;
import org.junit.Rule; 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.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.authentication.ldap;
import java.util.Collections; import java.util.Collections;
import org.junit.Rule; 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.Autowired;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;

View File

@ -21,7 +21,7 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.junit.Rule; 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.Autowired;
import org.springframework.ldap.core.DirContextOperations; import org.springframework.ldap.core.DirContextOperations;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ package org.springframework.security.config.annotation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;

View File

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

View File

@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.Properties; import java.util.Properties;
import org.junit.Rule; 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.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;

View File

@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.authentication; package org.springframework.security.config.annotation.authentication;
import org.junit.Rule; 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.Autowired;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;

View File

@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.authentication; package org.springframework.security.config.annotation.authentication;
import org.junit.Rule; 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.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.authentication;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.Rule; 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.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.authentication;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.Rule; 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.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.authentication; package org.springframework.security.config.annotation.authentication;
import org.junit.Rule; 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.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

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

View File

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

View File

@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.authentication.configuration; package org.springframework.security.config.annotation.authentication.configuration;
import org.junit.Rule; 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.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

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

View File

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

View File

@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.configuration; package org.springframework.security.config.annotation.configuration;
import org.junit.Rule; 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.BeanClassLoaderAware;
import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.BeanFactoryAware;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.method.configuration; package org.springframework.security.config.annotation.method.configuration;
import org.junit.Rule; 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.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@
package org.springframework.security.config.annotation.web; 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.beans.factory.BeanCreationException;
import org.springframework.mock.web.MockServletContext; import org.springframework.mock.web.MockServletContext;

View File

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

View File

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

View File

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

View File

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

View File

@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.junit.Rule; 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.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;

View File

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

View File

@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.junit.Rule; 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.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

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

View File

@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.web.builders; package org.springframework.security.config.annotation.web.builders;
import org.junit.Rule; 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.Autowired;
import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.AuthenticationManager;

View File

@ -22,7 +22,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.junit.Rule; 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.Autowired;
import org.springframework.security.access.AccessDecisionManager; import org.springframework.security.access.AccessDecisionManager;

View File

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

View File

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

View File

@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.web.configuration; package org.springframework.security.config.annotation.web.configuration;
import org.junit.Rule; 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.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

@ -22,7 +22,7 @@ import javax.servlet.http.HttpServletRequest;
import com.google.common.net.HttpHeaders; import com.google.common.net.HttpHeaders;
import org.junit.Rule; 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.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

@ -19,7 +19,7 @@ package org.springframework.security.config.annotation.web.configuration;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.junit.Rule; 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.BeanCreationException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.NoSuchBeanDefinitionException;

View File

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

View File

@ -24,7 +24,7 @@ import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest; import okhttp3.mockwebserver.RecordedRequest;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.junit.Rule; 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.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

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

View File

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

View File

@ -26,7 +26,7 @@ import javax.servlet.Filter;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.junit.Rule; 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.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

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

View File

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

View File

@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.web.configurers; package org.springframework.security.config.annotation.web.configurers;
import org.junit.Rule; 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.Autowired;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;

View File

@ -17,7 +17,7 @@
package org.springframework.security.config.annotation.web.configurers; package org.springframework.security.config.annotation.web.configurers;
import org.junit.Rule; 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.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

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