Migrate rest of test suite from JUnit 4 to JUnit Jupiter

This commit migrates the rest of Spring's test suite to JUnit Jupiter,
except spring-test which will be migrated in a separate commit.

See gh-23451
This commit is contained in:
Sam Brannen
2019-08-13 12:57:37 +02:00
parent 3df85c783f
commit 3f3e41923f
1487 changed files with 5428 additions and 4782 deletions

View File

@@ -22,7 +22,7 @@ import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanCreationException;

View File

@@ -19,7 +19,7 @@ package org.springframework.web.context;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockServletConfig;
import org.springframework.mock.web.test.MockServletContext;

View File

@@ -19,7 +19,7 @@ package org.springframework.web.context;
import java.util.Locale;
import javax.servlet.ServletException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;

View File

@@ -22,7 +22,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockHttpServletResponse;

View File

@@ -23,7 +23,7 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.BeanCreationException;

View File

@@ -18,7 +18,7 @@ package org.springframework.web.context.support;
import java.io.File;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.support.StaticApplicationContext;

View File

@@ -26,8 +26,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.PropertyValue;
@@ -83,7 +83,7 @@ public class DispatcherServletTests {
private DispatcherServlet complexDispatcherServlet;
@Before
@BeforeEach
public void setUp() throws ServletException {
MockServletConfig complexConfig = new MockServletConfig(getServletContext(), "complex");
complexConfig.addInitParameter("publishContext", "false");

View File

@@ -16,7 +16,7 @@
package org.springframework.web.servlet;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

View File

@@ -16,8 +16,8 @@
package org.springframework.web.servlet;
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.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockHttpServletResponse;
@@ -51,7 +51,7 @@ public class HandlerExecutionChainTests {
private AsyncHandlerInterceptor interceptor3;
@Before
@BeforeEach
public void setup() {
this.request = new MockHttpServletRequest();
this.response= new MockHttpServletResponse() ;

View File

@@ -18,7 +18,7 @@ package org.springframework.web.servlet.config;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

View File

@@ -40,8 +40,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory;
import org.joda.time.LocalDate;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.TypeMismatchException;
@@ -167,7 +167,7 @@ public class MvcNamespaceTests {
private HandlerMethod handlerMethod;
@Before
@BeforeEach
public void setup() throws Exception {
TestMockServletContext servletContext = new TestMockServletContext();
appContext = new XmlWebApplicationContext();

View File

@@ -19,8 +19,8 @@ package org.springframework.web.servlet.config.annotation;
import java.util.Arrays;
import java.util.Collections;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.http.MediaType;
import org.springframework.mock.web.test.MockHttpServletRequest;
@@ -45,7 +45,7 @@ public class ContentNegotiationConfigurerTests {
private MockHttpServletRequest servletRequest;
@Before
@BeforeEach
public void setup() {
this.servletRequest = new MockHttpServletRequest();
this.webRequest = new ServletWebRequest(this.servletRequest);

View File

@@ -19,8 +19,8 @@ package org.springframework.web.servlet.config.annotation;
import java.util.Arrays;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.web.cors.CorsConfiguration;
@@ -35,7 +35,7 @@ public class CorsRegistryTests {
private CorsRegistry registry;
@Before
@BeforeEach
public void setUp() {
this.registry = new CorsRegistry();
}

View File

@@ -18,8 +18,8 @@ package org.springframework.web.servlet.config.annotation;
import javax.servlet.RequestDispatcher;
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.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockHttpServletResponse;
@@ -44,7 +44,7 @@ public class DefaultServletHandlerConfigurerTests {
private MockHttpServletResponse response;
@Before
@BeforeEach
public void setup() {
response = new MockHttpServletResponse();
servletContext = new DispatchingMockServletContext();

View File

@@ -20,12 +20,12 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
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.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.format.support.FormattingConversionService;
import org.springframework.http.converter.HttpMessageConverter;
@@ -55,7 +55,7 @@ import static org.mockito.Mockito.verify;
*
* @author Rossen Stoyanchev
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class DelegatingWebMvcConfigurationTests {
@Mock

View File

@@ -21,8 +21,8 @@ import java.util.Arrays;
import java.util.Collections;
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.mockito.Mockito;
import org.springframework.core.Ordered;
@@ -67,7 +67,7 @@ public class InterceptorRegistryTests {
private final MockHttpServletResponse response = new MockHttpServletResponse();
@Before
@BeforeEach
public void setUp() {
this.registry = new InterceptorRegistry();
this.webInterceptor1 = new TestWebRequestInterceptor();

View File

@@ -21,8 +21,8 @@ import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.cache.concurrent.ConcurrentMapCache;
@@ -64,7 +64,7 @@ public class ResourceHandlerRegistryTests {
private MockHttpServletResponse response;
@Before
@BeforeEach
public void setUp() {
GenericWebApplicationContext appContext = new GenericWebApplicationContext();
appContext.refresh();

View File

@@ -19,8 +19,8 @@ package org.springframework.web.servlet.config.annotation;
import java.util.Collections;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.http.HttpStatus;
@@ -46,7 +46,7 @@ public class ViewControllerRegistryTests {
private MockHttpServletResponse response;
@Before
@BeforeEach
public void setup() {
this.registry = new ViewControllerRegistry(new StaticApplicationContext());
this.request = new MockHttpServletRequest("GET", "/");

View File

@@ -19,7 +19,7 @@ package org.springframework.web.servlet.config.annotation;
import java.io.IOException;
import javax.servlet.ServletException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@@ -18,8 +18,8 @@ package org.springframework.web.servlet.config.annotation;
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.beans.DirectFieldAccessor;
import org.springframework.core.Ordered;
@@ -53,7 +53,7 @@ public class ViewResolverRegistryTests {
private ViewResolverRegistry registry;
@Before
@BeforeEach
public void setup() {
StaticWebApplicationContext context = new StaticWebApplicationContext();
context.registerSingleton("freeMarkerConfigurer", FreeMarkerConfigurer.class);

View File

@@ -23,8 +23,8 @@ import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.core.Ordered;
@@ -113,7 +113,7 @@ public class WebMvcConfigurationSupportExtensionTests {
private StaticWebApplicationContext context;
@Before
@BeforeEach
public void setUp() {
this.context = new StaticWebApplicationContext();
this.context.setServletContext(new MockServletContext(new FileSystemResourceLoader()));

View File

@@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletRequest;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import org.joda.time.DateTime;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.context.ApplicationContext;

View File

@@ -27,7 +27,7 @@ import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.CacheControl;

View File

@@ -24,7 +24,7 @@ import java.util.List;
import java.util.Map;
import javax.servlet.http.Cookie;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;

View File

@@ -22,7 +22,7 @@ import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpMethod;
import org.springframework.http.converter.HttpMessageConverter;

View File

@@ -27,7 +27,7 @@ import java.util.Optional;
import java.util.OptionalLong;
import javax.servlet.http.Cookie;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;

View File

@@ -28,7 +28,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import javax.servlet.http.Cookie;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Mono;

View File

@@ -21,7 +21,7 @@ import java.util.Collections;
import java.util.Optional;
import java.util.function.Function;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

View File

@@ -18,8 +18,8 @@ package org.springframework.web.servlet.function;
import java.util.Collections;
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.test.MockHttpServletRequest;
@@ -32,7 +32,7 @@ public class RequestPredicateTests {
private ServerRequest request;
@Before
@BeforeEach
public void createRequest() {
this.request = new DefaultServerRequest(new MockHttpServletRequest(),
Collections.emptyList());

View File

@@ -19,7 +19,7 @@ package org.springframework.web.servlet.function;
import java.util.Collections;
import java.util.function.Function;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;

View File

@@ -23,8 +23,8 @@ import java.util.EnumSet;
import java.util.List;
import javax.servlet.ServletException;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
@@ -52,7 +52,7 @@ public class ResourceHandlerFunctionTests {
private ResourceHttpMessageConverter messageConverter;
@Before
@BeforeEach
public void createContext() {
this.messageConverter = new ResourceHttpMessageConverter();
this.context = new ServerResponse.Context() {

View File

@@ -19,7 +19,7 @@ package org.springframework.web.servlet.function;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

View File

@@ -18,7 +18,7 @@ package org.springframework.web.servlet.function;
import java.util.Optional;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;

View File

@@ -19,7 +19,7 @@ package org.springframework.web.servlet.function;
import java.util.Collections;
import java.util.Optional;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;

View File

@@ -16,7 +16,7 @@
package org.springframework.web.servlet.function;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;

View File

@@ -18,8 +18,8 @@ package org.springframework.web.servlet.handler;
import javax.servlet.ServletException;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.mock.web.test.MockHttpServletRequest;
@@ -43,7 +43,7 @@ public class BeanNameUrlHandlerMappingTests {
private ConfigurableWebApplicationContext wac;
@Before
@BeforeEach
public void setUp() throws Exception {
MockServletContext sc = new MockServletContext("");
wac = new XmlWebApplicationContext();

View File

@@ -22,8 +22,8 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.http.HttpHeaders;
@@ -54,7 +54,7 @@ public class CorsAbstractHandlerMappingTests {
private AbstractHandlerMapping handlerMapping;
@Before
@BeforeEach
public void setup() {
StaticWebApplicationContext context = new StaticWebApplicationContext();
this.handlerMapping = new TestHandlerMapping();

View File

@@ -21,7 +21,7 @@ import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.context.annotation.Bean;

View File

@@ -21,7 +21,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpStatus;
import org.springframework.mock.web.test.MockHttpServletRequest;

View File

@@ -23,8 +23,8 @@ import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.mock.web.test.MockHttpServletRequest;
@@ -60,7 +60,7 @@ public class HandlerMethodMappingTests {
private Method method2;
@Before
@BeforeEach
public void setUp() throws Exception {
this.mapping = new MyHandlerMethodMapping();
this.handler = new MyHandler();

View File

@@ -20,8 +20,8 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;
@@ -45,7 +45,7 @@ public class MappedInterceptorTests {
private final AntPathMatcher pathMatcher = new AntPathMatcher();
@Before
@BeforeEach
public void setup() {
this.interceptor = new LocaleChangeInterceptor();
}

View File

@@ -16,8 +16,8 @@
package org.springframework.web.servlet.handler;
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.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockServletContext;
@@ -41,7 +41,7 @@ public class PathMatchingUrlHandlerMappingTests {
private ConfigurableWebApplicationContext wac;
@Before
@BeforeEach
public void setUp() throws Exception {
MockServletContext sc = new MockServletContext("");
wac = new XmlWebApplicationContext();

View File

@@ -20,8 +20,8 @@ import java.util.Collections;
import java.util.Properties;
import javax.servlet.http.HttpServletResponse;
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.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockHttpServletResponse;
@@ -44,7 +44,7 @@ public class SimpleMappingExceptionResolverTests {
private Object handler2;
private Exception genericException;
@Before
@BeforeEach
public void setUp() throws Exception {
exceptionResolver = new SimpleMappingExceptionResolver();
handler1 = new String();

View File

@@ -18,7 +18,7 @@ package org.springframework.web.servlet.handler;
import java.util.Collections;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.FatalBeanException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;

View File

@@ -21,7 +21,7 @@ import java.util.Collections;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;

View File

@@ -21,7 +21,7 @@ import java.util.TimeZone;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.context.i18n.LocaleContext;
import org.springframework.context.i18n.SimpleLocaleContext;

View File

@@ -19,7 +19,7 @@ package org.springframework.web.servlet.i18n;
import java.util.Locale;
import java.util.TimeZone;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.context.i18n.LocaleContext;
import org.springframework.context.i18n.SimpleLocaleContext;

View File

@@ -19,7 +19,7 @@ package org.springframework.web.servlet.i18n;
import java.util.Locale;
import javax.servlet.http.HttpSession;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockHttpServletResponse;

View File

@@ -26,7 +26,7 @@ import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockHttpServletResponse;

View File

@@ -16,8 +16,8 @@
package org.springframework.web.servlet.mvc;
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.mock.web.test.MockHttpServletRequest;
@@ -40,7 +40,7 @@ public class ParameterizableViewControllerTests {
private MockHttpServletRequest request;
@Before
@BeforeEach
public void setup() {
this.controller = new ParameterizableViewController();
this.request = new MockHttpServletRequest("GET", "/");

View File

@@ -16,7 +16,7 @@
package org.springframework.web.servlet.mvc;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockHttpServletResponse;

View File

@@ -18,7 +18,7 @@ package org.springframework.web.servlet.mvc;
import java.util.Properties;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockHttpServletResponse;

View File

@@ -20,7 +20,7 @@ import java.io.IOException;
import java.io.Writer;
import javax.servlet.ServletException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.Pointcut;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;

View File

@@ -20,7 +20,7 @@ import java.io.IOException;
import java.io.Writer;
import javax.servlet.ServletException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.aop.interceptor.SimpleTraceInterceptor;

View File

@@ -20,8 +20,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Locale;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.TypeMismatchException;
import org.springframework.context.i18n.LocaleContextHolder;
@@ -53,7 +53,7 @@ public class ResponseStatusExceptionResolverTests {
private final MockHttpServletResponse response = new MockHttpServletResponse();
@Before
@BeforeEach
public void setup() {
exceptionResolver.setWarnLogCategory(exceptionResolver.getClass().getName());
}

View File

@@ -18,8 +18,8 @@ package org.springframework.web.servlet.mvc.condition;
import javax.servlet.http.HttpServletRequest;
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.test.MockHttpServletRequest;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -42,7 +42,7 @@ public class CompositeRequestConditionTests {
private HeadersRequestCondition header2;
private HeadersRequestCondition header3;
@Before
@BeforeEach
public void setup() {
this.param1 = new ParamsRequestCondition("param1");
this.param2 = new ParamsRequestCondition("param2");

View File

@@ -19,7 +19,7 @@ package org.springframework.web.servlet.mvc.condition;
import java.util.Collection;
import java.util.Collections;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.test.MockHttpServletRequest;

View File

@@ -18,7 +18,7 @@ package org.springframework.web.servlet.mvc.condition;
import java.util.Collection;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.HeaderExpression;

View File

@@ -18,7 +18,7 @@ package org.springframework.web.servlet.mvc.condition;
import java.util.Collection;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.web.servlet.mvc.condition.ParamsRequestCondition.ParamExpression;

View File

@@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;

View File

@@ -21,7 +21,7 @@ import java.util.Collection;
import java.util.Collections;
import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.http.MediaType;
import org.springframework.mock.web.test.MockHttpServletRequest;

View File

@@ -18,7 +18,7 @@ package org.springframework.web.servlet.mvc.condition;
import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.web.bind.annotation.RequestMethod;

View File

@@ -20,7 +20,7 @@ import java.util.Collections;
import javax.servlet.DispatcherType;
import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.test.MockHttpServletRequest;

View File

@@ -24,8 +24,8 @@ import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.http.HttpHeaders;
@@ -80,7 +80,7 @@ public class RequestMappingInfoHandlerMappingTests {
private HandlerMethod emptyMethod;
@Before
@BeforeEach
public void setup() throws Exception {
TestController testController = new TestController();

View File

@@ -18,7 +18,7 @@ package org.springframework.web.servlet.mvc.method;
import java.lang.reflect.Method;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.util.ClassUtils;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@@ -21,7 +21,7 @@ import java.util.Comparator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.test.MockHttpServletRequest;

View File

@@ -21,8 +21,8 @@ import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.MethodParameter;
@@ -61,7 +61,7 @@ public abstract class AbstractRequestAttributesArgumentResolverTests {
private Method handleMethod;
@Before
@BeforeEach
public void setup() throws Exception {
HttpServletRequest request = new MockHttpServletRequest();
HttpServletResponse response = new MockHttpServletResponse();

View File

@@ -18,7 +18,7 @@ package org.springframework.web.servlet.mvc.method.annotation;
import javax.servlet.ServletException;
import org.junit.After;
import org.junit.jupiter.api.AfterEach;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.ApplicationContextInitializer;
@@ -52,7 +52,7 @@ public abstract class AbstractServletHandlerMethodTests {
return servlet;
}
@After
@AfterEach
public void tearDown() {
this.servlet = null;
}

View File

@@ -24,8 +24,8 @@ import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Properties;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@@ -70,7 +70,7 @@ public class CrossOriginTests {
private final MockHttpServletRequest request = new MockHttpServletRequest();
@Before
@BeforeEach
@SuppressWarnings("resource")
public void setup() {
StaticWebApplicationContext wac = new StaticWebApplicationContext();

View File

@@ -18,8 +18,8 @@ package org.springframework.web.servlet.mvc.method.annotation;
import java.util.concurrent.CompletableFuture;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.mock.web.test.MockHttpServletRequest;
@@ -51,7 +51,7 @@ public class DeferredResultReturnValueHandlerTests {
private NativeWebRequest webRequest;
@Before
@BeforeEach
public void setup() throws Exception {
this.handler = new DeferredResultMethodReturnValueHandler();
this.request = new MockHttpServletRequest();

View File

@@ -21,9 +21,9 @@ import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.util.Collections;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.FatalBeanException;
@@ -75,7 +75,7 @@ public class ExceptionHandlerExceptionResolverTests {
private MockHttpServletResponse response;
@BeforeClass
@BeforeAll
public static void setupOnce() {
ExceptionHandlerExceptionResolver resolver = new ExceptionHandlerExceptionResolver();
resolver.afterPropertiesSet();
@@ -83,7 +83,7 @@ public class ExceptionHandlerExceptionResolverTests {
HANDLER_COUNT = resolver.getReturnValueHandlers().getHandlers().size();
}
@Before
@BeforeEach
public void setup() throws Exception {
this.resolver = new ExceptionHandlerExceptionResolver();
this.resolver.setWarnLogCategory(this.resolver.getClass().getName());
@@ -377,8 +377,10 @@ public class ExceptionHandlerExceptionResolverTests {
@Controller
static class ResponseBodyController extends WebApplicationObjectSupport implements ResponseBodyInterface {
@Override
public void handle() {}
@Override
@ExceptionHandler
@ResponseBody
public String handleException(IllegalArgumentException ex) {

View File

@@ -19,8 +19,8 @@ package org.springframework.web.servlet.mvc.method.annotation;
import java.util.HashMap;
import java.util.Map;
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.test.MockHttpServletRequest;
import org.springframework.tests.sample.beans.TestBean;
@@ -39,7 +39,7 @@ public class ExtendedServletRequestDataBinderTests {
private MockHttpServletRequest request;
@Before
@BeforeEach
public void setup() {
this.request = new MockHttpServletRequest();
}

View File

@@ -20,10 +20,8 @@ import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.aop.interceptor.SimpleTraceInterceptor;
@@ -60,11 +58,9 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Rossen Stoyanchev
* @author Sam Brannen
*/
@RunWith(Parameterized.class)
public class HandlerMethodAnnotationDetectionTests {
class HandlerMethodAnnotationDetectionTests {
@Parameters(name = "controller [{0}], auto-proxy [{1}]")
public static Object[][] handlerTypes() {
static Object[][] handlerTypes() {
return new Object[][] {
{ SimpleController.class, true }, // CGLIB proxy
{ SimpleController.class, false },
@@ -92,14 +88,14 @@ public class HandlerMethodAnnotationDetectionTests {
};
}
private RequestMappingHandlerMapping handlerMapping = new RequestMappingHandlerMapping();
private RequestMappingHandlerMapping handlerMapping;
private RequestMappingHandlerAdapter handlerAdapter = new RequestMappingHandlerAdapter();
private RequestMappingHandlerAdapter handlerAdapter;
private ExceptionHandlerExceptionResolver exceptionResolver = new ExceptionHandlerExceptionResolver();
private ExceptionHandlerExceptionResolver exceptionResolver;
public HandlerMethodAnnotationDetectionTests(Class<?> controllerType, boolean useAutoProxy) {
private void setUp(Class<?> controllerType, boolean useAutoProxy) {
GenericWebApplicationContext context = new GenericWebApplicationContext();
context.registerBeanDefinition("controller", new RootBeanDefinition(controllerType));
context.registerBeanDefinition("handlerMapping", new RootBeanDefinition(RequestMappingHandlerMapping.class));
@@ -120,8 +116,11 @@ public class HandlerMethodAnnotationDetectionTests {
}
@Test
public void testRequestMappingMethod() throws Exception {
@ParameterizedTest(name = "controller [{0}], auto-proxy [{1}]")
@MethodSource("handlerTypes")
void testRequestMappingMethod(Class<?> controllerType, boolean useAutoProxy) throws Exception {
setUp(controllerType, useAutoProxy);
String datePattern = "MM:dd:yyyy";
SimpleDateFormat dateFormat = new SimpleDateFormat(datePattern);
String dateA = "11:01:2011";

View File

@@ -29,8 +29,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.springframework.core.MethodParameter;
@@ -129,7 +129,7 @@ public class HttpEntityMethodProcessorMockTests {
private ServletWebRequest webRequest;
@Before
@BeforeEach
@SuppressWarnings("unchecked")
public void setup() throws Exception {

View File

@@ -23,8 +23,8 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.http.HttpEntity;
@@ -75,7 +75,7 @@ public class HttpEntityMethodProcessorTests {
private MockHttpServletResponse servletResponse;
@Before
@BeforeEach
public void setup() throws Exception {
Method method = getClass().getDeclaredMethod("handle", HttpEntity.class, HttpEntity.class);
paramList = new MethodParameter(method, 0);

View File

@@ -21,8 +21,8 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.mock.web.test.MockHttpServletRequest;
@@ -56,7 +56,7 @@ public class MatrixVariablesMapMethodArgumentResolverTests {
private final ResolvableMethod testMethod = ResolvableMethod.on(this.getClass()).named("handle").build();
@Before
@BeforeEach
public void setup() throws Exception {
this.resolver = new MatrixVariableMapMethodArgumentResolver();
this.mavContainer = new ModelAndViewContainer();

View File

@@ -21,8 +21,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.mock.web.test.MockHttpServletRequest;
@@ -57,7 +57,7 @@ public class MatrixVariablesMethodArgumentResolverTests {
private ResolvableMethod testMethod = ResolvableMethod.on(this.getClass()).named("handle").build();
@Before
@BeforeEach
public void setup() throws Exception {
this.resolver = new MatrixVariableMethodArgumentResolver();
this.mavContainer = new ModelAndViewContainer();

View File

@@ -18,8 +18,8 @@ package org.springframework.web.servlet.mvc.method.annotation;
import java.lang.reflect.Method;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.mock.web.test.MockHttpServletRequest;
@@ -48,7 +48,7 @@ public class ModelAndViewMethodReturnValueHandlerTests {
private MethodParameter returnParamModelAndView;
@Before
@BeforeEach
public void setup() throws Exception {
this.handler = new ModelAndViewMethodReturnValueHandler();
this.mavContainer = new ModelAndViewContainer();

View File

@@ -20,8 +20,8 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
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.core.MethodParameter;
import org.springframework.mock.web.test.MockHttpServletRequest;
@@ -52,7 +52,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
private ServletWebRequest request;
@Before
@BeforeEach
public void setup() {
mavResolvers = new ArrayList<>();
handler = new ModelAndViewResolverMethodReturnValueHandler(mavResolvers);

View File

@@ -28,9 +28,9 @@ import javax.servlet.http.HttpServletRequest;
import org.joda.time.DateTime;
import org.joda.time.format.ISODateTimeFormat;
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.annotation.Bean;
import org.springframework.format.annotation.DateTimeFormat;
@@ -83,12 +83,12 @@ public class MvcUriComponentsBuilderTests {
private final MockHttpServletRequest request = new MockHttpServletRequest();
@Before
@BeforeEach
public void setup() {
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(this.request));
}
@After
@AfterEach
public void reset() {
RequestContextHolder.resetRequestAttributes();
}

View File

@@ -21,8 +21,8 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.mock.web.test.MockHttpServletRequest;
@@ -54,7 +54,7 @@ public class PathVariableMapMethodArgumentResolverTests {
private MethodParameter paramMapNoAnnot;
@Before
@BeforeEach
public void setup() throws Exception {
resolver = new PathVariableMapMethodArgumentResolver();
mavContainer = new ModelAndViewContainer();

View File

@@ -21,8 +21,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.core.annotation.SynthesizingMethodParameter;
@@ -65,7 +65,7 @@ public class PathVariableMethodArgumentResolverTests {
private MethodParameter paramOptional;
@Before
@BeforeEach
public void setup() throws Exception {
resolver = new PathVariableMethodArgumentResolver();
mavContainer = new ModelAndViewContainer();

View File

@@ -26,8 +26,8 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.EmitterProcessor;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -73,7 +73,7 @@ public class ReactiveTypeHandlerTests {
private NativeWebRequest webRequest;
@Before
@BeforeEach
public void setup() throws Exception {
ContentNegotiationManagerFactoryBean factoryBean = new ContentNegotiationManagerFactoryBean();
factoryBean.afterPropertiesSet();

View File

@@ -34,9 +34,9 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
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.Value;
import org.springframework.beans.propertyeditors.CustomDateEditor;
@@ -106,7 +106,7 @@ public class RequestMappingHandlerAdapterIntegrationTests {
private MockHttpServletResponse response;
@Before
@BeforeEach
public void setup() throws Exception {
ConfigurableWebBindingInitializer bindingInitializer = new ConfigurableWebBindingInitializer();
bindingInitializer.setValidator(new StubValidator());
@@ -133,7 +133,7 @@ public class RequestMappingHandlerAdapterIntegrationTests {
RequestContextHolder.setRequestAttributes(new ServletWebRequest(request));
}
@After
@AfterEach
public void teardown() {
RequestContextHolder.resetRequestAttributes();
}

View File

@@ -25,9 +25,9 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.http.HttpInputMessage;
@@ -86,7 +86,7 @@ public class RequestMappingHandlerAdapterTests {
private StaticWebApplicationContext webAppContext;
@BeforeClass
@BeforeAll
public static void setupOnce() {
RequestMappingHandlerAdapter adapter = new RequestMappingHandlerAdapter();
adapter.setApplicationContext(new StaticWebApplicationContext());
@@ -97,7 +97,7 @@ public class RequestMappingHandlerAdapterTests {
HANDLER_COUNT = adapter.getReturnValueHandlers().size();
}
@Before
@BeforeEach
public void setup() throws Exception {
this.webAppContext = new StaticWebApplicationContext();
this.handlerAdapter = new RequestMappingHandlerAdapter();

View File

@@ -28,7 +28,7 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.annotation.AliasFor;
import org.springframework.http.MediaType;

View File

@@ -30,10 +30,10 @@ import org.eclipse.jetty.server.NetworkConnector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
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.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -85,7 +85,7 @@ public class RequestPartIntegrationTests {
private static String baseUrl;
@BeforeClass
@BeforeAll
public static void startServer() throws Exception {
// Let server pick its own random, available port.
server = new Server(0);
@@ -114,14 +114,14 @@ public class RequestPartIntegrationTests {
baseUrl = "http://localhost:" + connector.getLocalPort();
}
@AfterClass
@AfterAll
public static void stopServer() throws Exception {
if (server != null) {
server.stop();
}
}
@Before
@BeforeEach
public void setup() {
ByteArrayHttpMessageConverter emptyBodyConverter = new ByteArrayHttpMessageConverter();
emptyBodyConverter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON));

View File

@@ -26,8 +26,8 @@ import javax.servlet.http.Part;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.MethodParameter;
@@ -103,7 +103,7 @@ public class RequestPartMethodArgumentResolverTests {
private MethodParameter optionalRequestPart;
@Before
@BeforeEach
@SuppressWarnings("unchecked")
public void setup() throws Exception {
messageConverter = mock(HttpMessageConverter.class);

View File

@@ -21,8 +21,8 @@ import java.util.Arrays;
import java.util.Collections;
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.mockito.Mockito;
import org.springframework.core.MethodParameter;
@@ -68,7 +68,7 @@ public class RequestResponseBodyAdviceChainTests {
private ServerHttpResponse response;
@Before
@BeforeEach
public void setup() {
this.body = "body";
this.contentType = MediaType.TEXT_PLAIN;

View File

@@ -25,8 +25,8 @@ import java.util.Optional;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.core.io.ByteArrayResource;
@@ -107,7 +107,7 @@ public class RequestResponseBodyMethodProcessorMockTests {
private MethodParameter returnTypeResource;
@Before
@BeforeEach
@SuppressWarnings("unchecked")
public void setup() throws Exception {
stringMessageConverter = mock(HttpMessageConverter.class);

View File

@@ -29,8 +29,8 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonView;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.target.SingletonTargetSource;
@@ -102,7 +102,7 @@ public class RequestResponseBodyMethodProcessorTests {
private MethodParameter returnTypeString;
@Before
@BeforeEach
public void setup() throws Exception {
container = new ModelAndViewContainer();
servletRequest = new MockHttpServletRequest();

View File

@@ -22,8 +22,8 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.EmitterProcessor;
import reactor.core.publisher.Flux;
@@ -69,7 +69,7 @@ public class ResponseBodyEmitterReturnValueHandlerTests {
private final ModelAndViewContainer mavContainer = new ModelAndViewContainer();
@Before
@BeforeEach
public void setup() throws Exception {
List<HttpMessageConverter<?>> converters = Arrays.asList(

View File

@@ -18,11 +18,11 @@ package org.springframework.web.servlet.mvc.method.annotation;
import java.io.IOException;
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.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.http.MediaType;
@@ -42,7 +42,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
* @author Rossen Stoyanchev
* @author Tomasz Nurkiewicz
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class ResponseBodyEmitterTests {
@Mock

View File

@@ -22,7 +22,7 @@ import java.util.EnumSet;
import java.util.List;
import javax.servlet.ServletException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.ConversionNotSupportedException;
import org.springframework.beans.TypeMismatchException;

View File

@@ -58,7 +58,7 @@ import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.aop.interceptor.SimpleTraceInterceptor;

View File

@@ -19,8 +19,8 @@ package org.springframework.web.servlet.mvc.method.annotation;
import java.lang.reflect.Method;
import javax.servlet.http.Cookie;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.core.annotation.SynthesizingMethodParameter;
@@ -49,7 +49,7 @@ public class ServletCookieValueMethodArgumentResolverTests {
private MethodParameter cookieStringParameter;
@Before
@BeforeEach
public void setup() throws Exception {
resolver = new ServletCookieValueMethodArgumentResolver(null);
request = new MockHttpServletRequest();

View File

@@ -24,7 +24,7 @@ import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.core.MethodParameter;

View File

@@ -21,8 +21,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.core.convert.support.DefaultConversionService;
@@ -61,7 +61,7 @@ public class ServletModelAttributeMethodProcessorTests {
private MethodParameter testBeanWithOptionalModelAttr;
@Before
@BeforeEach
public void setup() throws Exception {
processor = new ServletModelAttributeMethodProcessor(false);

View File

@@ -27,8 +27,8 @@ import javax.servlet.ServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.PushBuilder;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.core.MethodParameter;
@@ -64,7 +64,7 @@ public class ServletRequestMethodArgumentResolverTests {
private Method method;
@Before
@BeforeEach
public void setup() throws Exception {
resolver = new ServletRequestMethodArgumentResolver();
mavContainer = new ModelAndViewContainer();

View File

@@ -21,8 +21,8 @@ import java.io.Writer;
import java.lang.reflect.Method;
import javax.servlet.ServletResponse;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.mock.web.test.MockHttpServletRequest;
@@ -50,7 +50,7 @@ public class ServletResponseMethodArgumentResolverTests {
private Method method;
@Before
@BeforeEach
public void setup() throws Exception {
resolver = new ServletResponseMethodArgumentResolver();
mavContainer = new ModelAndViewContainer();

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