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;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.acls.domain.AclFormattingUtils;
import org.springframework.security.acls.model.Permission;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,9 +20,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@ -74,7 +74,7 @@ public class AnnotationSecurityAspectTests {
private PrePostSecured prePostSecured = new PrePostSecured();
@Before
@BeforeEach
public final void setUp() {
MockitoAnnotations.initMocks(this);
this.interceptor = new AspectJMethodSecurityInterceptor();
@ -88,7 +88,7 @@ public class AnnotationSecurityAspectTests {
secAspect.setSecurityInterceptor(this.interceptor);
}
@After
@AfterEach
public void 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.AssertionImpl;
import org.jasig.cas.client.validation.TicketValidator;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.authentication.BadCredentialsException;

View File

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

View File

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

View File

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

View File

@ -16,8 +16,8 @@
package org.springframework.security.cas.authentication;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.cache.CacheManager;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
@ -36,7 +36,7 @@ public class SpringCacheBasedTicketCacheTests extends AbstractStatelessTicketCac
private static CacheManager cacheManager;
@BeforeClass
@BeforeAll
public static void initCacheManaer() {
cacheManager = new ConcurrentMapCacheManager();
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.AssertionImpl;
import org.json.JSONException;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.security.cas.authentication.CasAuthenticationToken;
@ -92,7 +92,7 @@ public class CasAuthenticationTokenMixinTests {
protected ObjectMapper mapper;
@Before
@BeforeEach
public void setup() {
this.mapper = new ObjectMapper();
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.validation.Assertion;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.security.cas.authentication.CasAssertionAuthenticationToken;
import org.springframework.security.core.authority.AuthorityUtils;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,9 +18,9 @@ package org.springframework.security.config.annotation.method.configuration;
import java.io.Serializable;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@ -51,7 +51,7 @@ public class SampleEnableGlobalMethodSecurityTests {
@Autowired
private MethodSecurityService methodSecurityService;
@Before
@BeforeEach
public void setup() {
SecurityContextHolder.getContext()
.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 org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
@ -39,7 +39,7 @@ import org.springframework.security.config.test.SpringTestRule;
import org.springframework.security.test.context.annotation.SecurityTestExecutionListeners;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@ -51,7 +51,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
* @author Josh Cummings
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@SecurityTestExecutionListeners
public class Sec2758Tests {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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