openrewrite Junit Migration
This commit is contained in:
@@ -21,7 +21,7 @@ import java.io.File;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
+5
-5
@@ -23,9 +23,9 @@ import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
|
||||
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.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
@@ -59,7 +59,7 @@ public class AbstractAuthorizeTagTests {
|
||||
|
||||
private MockServletContext servletContext;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.tag = new AuthzTag();
|
||||
this.request = new MockHttpServletRequest();
|
||||
@@ -67,7 +67,7 @@ public class AbstractAuthorizeTagTests {
|
||||
this.servletContext = new MockServletContext();
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void teardown() {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
+5
-5
@@ -22,9 +22,9 @@ import java.util.Map;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.jsp.tagext.Tag;
|
||||
|
||||
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.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
@@ -58,7 +58,7 @@ public class AccessControlListTagTests {
|
||||
|
||||
Authentication bob = new TestingAuthenticationToken("bob", "bobspass", "A");
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void setup() {
|
||||
SecurityContextHolder.getContext().setAuthentication(this.bob);
|
||||
@@ -74,7 +74,7 @@ public class AccessControlListTagTests {
|
||||
this.tag.setPageContext(this.pageContext);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void clearContext() {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
+3
-3
@@ -19,8 +19,8 @@ package org.springframework.security.taglibs.authz;
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.tagext.Tag;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.security.authentication.TestingAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
@@ -44,7 +44,7 @@ public class AuthenticationTagTests {
|
||||
new User("rodUserDetails", "koala", true, true, true, true, AuthorityUtils.NO_AUTHORITIES), "koala",
|
||||
AuthorityUtils.NO_AUTHORITIES);
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
+8
-8
@@ -19,12 +19,12 @@ package org.springframework.security.taglibs.authz;
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.tagext.Tag;
|
||||
|
||||
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.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
@@ -49,7 +49,7 @@ import static org.mockito.BDDMockito.given;
|
||||
* @author Francois Beausoleil
|
||||
* @author Luke Taylor
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class AuthorizeTagTests {
|
||||
|
||||
@Mock
|
||||
@@ -62,7 +62,7 @@ public class AuthorizeTagTests {
|
||||
private final TestingAuthenticationToken currentUser = new TestingAuthenticationToken("abc", "123",
|
||||
"ROLE SUPERVISOR", "ROLE_TELLER");
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
SecurityContextHolder.getContext().setAuthentication(this.currentUser);
|
||||
StaticWebApplicationContext ctx = new StaticWebApplicationContext();
|
||||
@@ -77,7 +77,7 @@ public class AuthorizeTagTests {
|
||||
this.authorizeTag.setPageContext(new MockPageContext(servletCtx, this.request, new MockHttpServletResponse()));
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
+3
-3
@@ -21,8 +21,8 @@ import java.io.UnsupportedEncodingException;
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.tagext.Tag;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
@@ -44,7 +44,7 @@ public class AbstractCsrfTagTests {
|
||||
|
||||
private MockHttpServletResponse response;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
MockServletContext servletContext = new MockServletContext();
|
||||
this.request = new MockHttpServletRequest(servletContext);
|
||||
|
||||
+3
-3
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.security.taglibs.csrf;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.security.web.csrf.CsrfToken;
|
||||
import org.springframework.security.web.csrf.DefaultCsrfToken;
|
||||
@@ -31,7 +31,7 @@ public class CsrfInputTagTests {
|
||||
|
||||
public CsrfInputTag tag;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
this.tag = new CsrfInputTag();
|
||||
}
|
||||
|
||||
+3
-3
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.security.taglibs.csrf;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.security.web.csrf.CsrfToken;
|
||||
import org.springframework.security.web.csrf.DefaultCsrfToken;
|
||||
@@ -31,7 +31,7 @@ public class CsrfMetaTagsTagTests {
|
||||
|
||||
public CsrfMetaTagsTag tag;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
this.tag = new CsrfMetaTagsTag();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user