Remove obsolete "test" prefix from test method names

Although this commit also changes the visibility of some test methods
to package-private, the remainder of that task will be addressed in
conjunction with gh-36496.

Closes gh-36495

(cherry picked from commit 4c14abf0cd)
This commit is contained in:
Sam Brannen
2026-03-16 13:37:56 +01:00
parent 40562e2485
commit 01248c7753
581 changed files with 3212 additions and 3235 deletions
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThatIOException;
class HttpRequestHandlerTests {
@Test
void testHttpRequestHandlerServletPassThrough() throws Exception {
void httpRequestHandlerServletPassThrough() throws Exception {
MockServletContext servletContext = new MockServletContext();
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
@@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
class ServletContextSupportTests {
@Test
void testServletContextAttributeFactoryBean() {
void servletContextAttributeFactoryBean() {
MockServletContext sc = new MockServletContext();
sc.setAttribute("myAttr", "myValue");
@@ -60,7 +60,7 @@ class ServletContextSupportTests {
}
@Test
void testServletContextAttributeFactoryBeanWithAttributeNotFound() {
void servletContextAttributeFactoryBeanWithAttributeNotFound() {
MockServletContext sc = new MockServletContext();
StaticWebApplicationContext wac = new StaticWebApplicationContext();
@@ -76,7 +76,7 @@ class ServletContextSupportTests {
}
@Test
void testServletContextParameterFactoryBean() {
void servletContextParameterFactoryBean() {
MockServletContext sc = new MockServletContext();
sc.addInitParameter("myParam", "myValue");
@@ -92,7 +92,7 @@ class ServletContextSupportTests {
}
@Test
void testServletContextParameterFactoryBeanWithAttributeNotFound() {
void servletContextParameterFactoryBeanWithAttributeNotFound() {
MockServletContext sc = new MockServletContext();
StaticWebApplicationContext wac = new StaticWebApplicationContext();
@@ -108,7 +108,7 @@ class ServletContextSupportTests {
}
@Test
void testServletContextAttributeExporter() {
void servletContextAttributeExporter() {
TestBean tb = new TestBean();
Map<String, Object> attributes = new HashMap<>();
attributes.put("attr1", "value1");
@@ -124,7 +124,7 @@ class ServletContextSupportTests {
}
@Test
void testServletContextResourceLoader() {
void servletContextResourceLoader() {
MockServletContext sc = new MockServletContext("classpath:org/springframework/web/context");
ServletContextResourceLoader rl = new ServletContextResourceLoader(sc);
assertThat(rl.getResource("/WEB-INF/web.xml").exists()).isTrue();
@@ -134,7 +134,7 @@ class ServletContextSupportTests {
}
@Test
void testServletContextResourcePatternResolver() throws IOException {
void servletContextResourcePatternResolver() throws IOException {
final Set<String> paths = new HashSet<>();
paths.add("/WEB-INF/context1.xml");
paths.add("/WEB-INF/context2.xml");
@@ -161,7 +161,7 @@ class ServletContextSupportTests {
}
@Test
void testServletContextResourcePatternResolverWithPatternPath() throws IOException {
void servletContextResourcePatternResolverWithPatternPath() throws IOException {
final Set<String> dirs = new HashSet<>();
dirs.add("/WEB-INF/mydir1/");
dirs.add("/WEB-INF/mydir2/");
@@ -194,7 +194,7 @@ class ServletContextSupportTests {
}
@Test
void testServletContextResourcePatternResolverWithUnboundedPatternPath() throws IOException {
void servletContextResourcePatternResolverWithUnboundedPatternPath() throws IOException {
final Set<String> dirs = new HashSet<>();
dirs.add("/WEB-INF/mydir1/");
dirs.add("/WEB-INF/mydir2/");
@@ -235,7 +235,7 @@ class ServletContextSupportTests {
}
@Test
void testServletContextResourcePatternResolverWithAbsolutePaths() throws IOException {
void servletContextResourcePatternResolverWithAbsolutePaths() throws IOException {
final Set<String> paths = new HashSet<>();
paths.add("C:/webroot/WEB-INF/context1.xml");
paths.add("C:/webroot/WEB-INF/context2.xml");
@@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
class WebApplicationObjectSupportTests {
@Test
void testWebApplicationObjectSupport() {
void webApplicationObjectSupport() {
StaticWebApplicationContext wac = new StaticWebApplicationContext();
wac.setServletContext(new MockServletContext());
File tempDir = new File("");
@@ -49,7 +49,7 @@ class WebApplicationObjectSupportTests {
}
@Test
void testWebApplicationObjectSupportWithWrongContext() {
void webApplicationObjectSupportWithWrongContext() {
StaticApplicationContext ac = new StaticApplicationContext();
ac.registerBeanDefinition("test", new RootBeanDefinition(TestWebApplicationObject.class));
WebApplicationObjectSupport wao = (WebApplicationObjectSupport) ac.getBean("test");
@@ -64,7 +64,7 @@ class AnnotationDrivenBeanDefinitionParserTests {
private final GenericWebApplicationContext appContext = new GenericWebApplicationContext();
@Test
void testMessageCodesResolver() {
void messageCodesResolver() {
loadBeanDefinitions("mvc-config-message-codes-resolver.xml");
RequestMappingHandlerAdapter adapter = this.appContext.getBean(RequestMappingHandlerAdapter.class);
assertThat(adapter).isNotNull();
@@ -80,7 +80,7 @@ class AnnotationDrivenBeanDefinitionParserTests {
@Test
@SuppressWarnings("deprecation")
public void testPathMatchingConfiguration() {
void pathMatchingConfiguration() {
loadBeanDefinitions("mvc-config-path-matching.xml");
RequestMappingHandlerMapping hm = this.appContext.getBean(RequestMappingHandlerMapping.class);
assertThat(hm).isNotNull();
@@ -95,7 +95,7 @@ class AnnotationDrivenBeanDefinitionParserTests {
}
@Test
void testMessageConverters() {
void messageConverters() {
loadBeanDefinitions("mvc-config-message-converters.xml");
verifyMessageConverters(this.appContext.getBean(RequestMappingHandlerAdapter.class), true);
verifyMessageConverters(this.appContext.getBean(ExceptionHandlerExceptionResolver.class), true);
@@ -104,14 +104,14 @@ class AnnotationDrivenBeanDefinitionParserTests {
}
@Test
void testMessageConvertersWithoutDefaultRegistrations() {
void messageConvertersWithoutDefaultRegistrations() {
loadBeanDefinitions("mvc-config-message-converters-defaults-off.xml");
verifyMessageConverters(this.appContext.getBean(RequestMappingHandlerAdapter.class), false);
verifyMessageConverters(this.appContext.getBean(ExceptionHandlerExceptionResolver.class), false);
}
@Test
void testArgumentResolvers() {
void argumentResolvers() {
loadBeanDefinitions("mvc-config-argument-resolvers.xml");
testArgumentResolvers(this.appContext.getBean(RequestMappingHandlerAdapter.class));
testArgumentResolvers(this.appContext.getBean(ExceptionHandlerExceptionResolver.class));
@@ -132,7 +132,7 @@ class AnnotationDrivenBeanDefinitionParserTests {
}
@Test
void testReturnValueHandlers() {
void returnValueHandlers() {
loadBeanDefinitions("mvc-config-return-value-handlers.xml");
testReturnValueHandlers(this.appContext.getBean(RequestMappingHandlerAdapter.class));
testReturnValueHandlers(this.appContext.getBean(ExceptionHandlerExceptionResolver.class));
@@ -197,7 +197,7 @@ public class MvcNamespaceTests {
@Test
void testDefaultConfig() throws Exception {
void defaultConfig() throws Exception {
loadBeanDefinitions("mvc-config.xml");
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
@@ -276,7 +276,7 @@ public class MvcNamespaceTests {
}
@Test // gh-25290
void testDefaultConfigWithBeansInParentContext() {
void defaultConfigWithBeansInParentContext() {
StaticApplicationContext parent = new StaticApplicationContext();
parent.registerSingleton("localeResolver", CookieLocaleResolver.class);
parent.registerSingleton("themeResolver", CookieThemeResolver.class);
@@ -293,7 +293,7 @@ public class MvcNamespaceTests {
}
@Test
void testCustomConversionService() throws Exception {
void customConversionService() throws Exception {
loadBeanDefinitions("mvc-config-custom-conversion-service.xml");
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
@@ -320,7 +320,7 @@ public class MvcNamespaceTests {
}
@Test
void testCustomValidator() throws Exception {
void customValidator() throws Exception {
doTestCustomValidator("mvc-config-custom-validator.xml");
}
@@ -346,7 +346,7 @@ public class MvcNamespaceTests {
}
@Test
void testInterceptors() throws Exception {
void interceptors() throws Exception {
loadBeanDefinitions("mvc-config-interceptors.xml");
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
@@ -380,7 +380,7 @@ public class MvcNamespaceTests {
@Test
@SuppressWarnings("deprecation")
void testResources() throws Exception {
void resources() throws Exception {
loadBeanDefinitions("mvc-config-resources.xml");
HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
@@ -430,7 +430,7 @@ public class MvcNamespaceTests {
}
@Test
void testUseDeprecatedPathMatcher() throws Exception {
void useDeprecatedPathMatcher() throws Exception {
loadBeanDefinitions("mvc-config-deprecated-path-matcher.xml");
Map<String, AbstractHandlerMapping> handlerMappings = appContext.getBeansOfType(AbstractHandlerMapping.class);
AntPathMatcher mvcPathMatcher = appContext.getBean("pathMatcher", AntPathMatcher.class);
@@ -442,7 +442,7 @@ public class MvcNamespaceTests {
}
@Test
void testUsePathPatternParser() throws Exception {
void usePathPatternParser() throws Exception {
loadBeanDefinitions("mvc-config-custom-pattern-parser.xml");
PathPatternParser patternParser = appContext.getBean("patternParser", PathPatternParser.class);
@@ -455,7 +455,7 @@ public class MvcNamespaceTests {
}
@Test
void testResourcesWithOptionalAttributes() {
void resourcesWithOptionalAttributes() {
loadBeanDefinitions("mvc-config-resources-optional-attrs.xml");
SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
@@ -471,7 +471,7 @@ public class MvcNamespaceTests {
@Test
@SuppressWarnings("removal")
void testResourcesWithResolversTransformers() {
void resourcesWithResolversTransformers() {
loadBeanDefinitions("mvc-config-resources-chain.xml");
SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
@@ -516,7 +516,7 @@ public class MvcNamespaceTests {
}
@Test
void testResourcesWithResolversTransformersCustom() {
void resourcesWithResolversTransformersCustom() {
loadBeanDefinitions("mvc-config-resources-chain-no-auto.xml");
SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
@@ -548,7 +548,7 @@ public class MvcNamespaceTests {
}
@Test
void testDefaultServletHandler() throws Exception {
void defaultServletHandler() throws Exception {
loadBeanDefinitions("mvc-config-default-servlet.xml");
HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
@@ -574,7 +574,7 @@ public class MvcNamespaceTests {
}
@Test
void testDefaultServletHandlerWithOptionalAttributes() throws Exception {
void defaultServletHandlerWithOptionalAttributes() throws Exception {
loadBeanDefinitions("mvc-config-default-servlet-optional-attrs.xml");
HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
@@ -600,7 +600,7 @@ public class MvcNamespaceTests {
}
@Test
void testBeanDecoration() throws Exception {
void beanDecoration() throws Exception {
loadBeanDefinitions("mvc-config-bean-decoration.xml");
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
@@ -621,7 +621,7 @@ public class MvcNamespaceTests {
}
@Test
void testViewControllers() throws Exception {
void viewControllers() throws Exception {
loadBeanDefinitions("mvc-config-view-controllers.xml");
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
@@ -705,7 +705,7 @@ public class MvcNamespaceTests {
/** WebSphere gives trailing servlet path slashes by default!! */
@Test
void testViewControllersOnWebSphere() throws Exception {
void viewControllersOnWebSphere() throws Exception {
loadBeanDefinitions("mvc-config-view-controllers.xml");
SimpleUrlHandlerMapping mapping2 = appContext.getBean(SimpleUrlHandlerMapping.class);
@@ -750,7 +750,7 @@ public class MvcNamespaceTests {
}
@Test
void testViewControllersDefaultConfig() {
void viewControllersDefaultConfig() {
loadBeanDefinitions("mvc-config-view-controllers-minimal.xml");
SimpleUrlHandlerMapping hm = this.appContext.getBean(SimpleUrlHandlerMapping.class);
@@ -773,7 +773,7 @@ public class MvcNamespaceTests {
}
@Test
void testContentNegotiationManager() throws Exception {
void contentNegotiationManager() throws Exception {
loadBeanDefinitions("mvc-config-content-negotiation-manager.xml");
RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
@@ -798,7 +798,7 @@ public class MvcNamespaceTests {
}
@Test
void testAsyncSupportOptions() {
void asyncSupportOptions() {
loadBeanDefinitions("mvc-config-async-support.xml");
RequestMappingHandlerAdapter adapter = appContext.getBean(RequestMappingHandlerAdapter.class);
@@ -818,7 +818,7 @@ public class MvcNamespaceTests {
}
@Test
void testViewResolution() {
void viewResolution() {
loadBeanDefinitions("mvc-config-view-resolution.xml");
ViewResolverComposite compositeResolver = this.appContext.getBean(ViewResolverComposite.class);
@@ -883,7 +883,7 @@ public class MvcNamespaceTests {
}
@Test
void testViewResolutionWithContentNegotiation() {
void viewResolutionWithContentNegotiation() {
loadBeanDefinitions("mvc-config-view-resolution-content-negotiation.xml");
ViewResolverComposite compositeResolver = this.appContext.getBean(ViewResolverComposite.class);
@@ -907,7 +907,7 @@ public class MvcNamespaceTests {
}
@Test
void testViewResolutionWithOrderSet() {
void viewResolutionWithOrderSet() {
loadBeanDefinitions("mvc-config-view-resolution-custom-order.xml");
ViewResolverComposite compositeResolver = this.appContext.getBean(ViewResolverComposite.class);
@@ -917,7 +917,7 @@ public class MvcNamespaceTests {
}
@Test
void testPathMatchingHandlerMappings() {
void pathMatchingHandlerMappings() {
loadBeanDefinitions("mvc-config-path-matching-mappings.xml");
RequestMappingHandlerMapping requestMapping = appContext.getBean(RequestMappingHandlerMapping.class);
@@ -938,7 +938,7 @@ public class MvcNamespaceTests {
}
@Test
void testCorsMinimal() {
void corsMinimal() {
loadBeanDefinitions("mvc-config-cors-minimal.xml");
String[] beanNames = appContext.getBeanNamesForType(AbstractHandlerMapping.class);
@@ -963,7 +963,7 @@ public class MvcNamespaceTests {
}
@Test
void testCors() {
void cors() {
loadBeanDefinitions("mvc-config-cors.xml");
String[] beanNames = appContext.getBeanNamesForType(AbstractHandlerMapping.class);
@@ -95,7 +95,7 @@ class DefaultServletHandlerConfigurerTests {
}
@Test // gh-30113
public void handleIncludeRequest() throws Exception {
void handleIncludeRequest() throws Exception {
configurer.enable();
SimpleUrlHandlerMapping mapping = configurer.buildHandlerMapping();
HttpRequestHandler handler = (DefaultServletHttpRequestHandler) mapping.getUrlMap().get("/**");
@@ -203,7 +203,7 @@ public class DelegatingWebMvcConfigurationTests {
}
@Test
public void addErrorResponseInterceptors() {
void addErrorResponseInterceptors() {
ErrorResponse.Interceptor interceptor = (detail, errorResponse) -> {};
WebMvcConfigurer configurer = new WebMvcConfigurer() {
@Override
@@ -232,7 +232,7 @@ public class DelegatingWebMvcConfigurationTests {
@Test
@SuppressWarnings("deprecation")
public void configurePathMatcher() {
void configurePathMatcher() {
PathMatcher pathMatcher = mock();
UrlPathHelper pathHelper = mock();
@@ -144,7 +144,7 @@ public class InterceptorRegistryTests {
}
@Test // SPR-11130
public void addInterceptorWithExcludePathPatternOnly() {
void addInterceptorWithExcludePathPatternOnly() {
this.registry.addInterceptor(this.interceptor1).excludePathPatterns("/path1/secret");
this.registry.addInterceptor(this.interceptor2).addPathPatterns("/path2");
@@ -265,7 +265,7 @@ class WebMvcConfigurationSupportExtensionTests {
@Test
@SuppressWarnings("deprecation")
public void contentNegotiation() throws Exception {
void contentNegotiation() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo");
NativeWebRequest webRequest = new ServletWebRequest(request);
@@ -220,7 +220,7 @@ class WebMvcConfigurationSupportTests {
@Test
@SuppressWarnings("unchecked")
public void handlerExceptionResolver() {
void handlerExceptionResolver() {
ApplicationContext context = initContext(WebConfig.class);
HandlerExceptionResolverComposite compositeResolver =
context.getBean("handlerExceptionResolver", HandlerExceptionResolverComposite.class);
@@ -117,7 +117,7 @@ public class HandlerMethodMappingTests {
}
@Test // gh-26490
public void ambiguousMatchOnPreFlightRequestWithoutCorsConfig() throws Exception {
void ambiguousMatchOnPreFlightRequestWithoutCorsConfig() throws Exception {
this.mapping.registerMapping("/foo", this.handler, this.method1);
this.mapping.registerMapping("/f??", this.handler, this.method2);
@@ -139,7 +139,7 @@ public class HandlerMethodMappingTests {
}
@Test // gh-26490
public void ambiguousMatchOnPreFlightRequestWithCorsConfig() throws Exception {
void ambiguousMatchOnPreFlightRequestWithCorsConfig() throws Exception {
this.mapping.registerMapping("/f?o", this.handler, this.method1);
this.mapping.registerMapping("/fo?", this.handler, this.handler.getClass().getMethod("corsHandlerMethod"));
@@ -111,7 +111,7 @@ class ResponseStatusExceptionResolverTests {
}
@Test // SPR-12903
public void nestedException() {
void nestedException() {
Exception cause = new StatusCodeAndReasonMessageException();
TypeMismatchException ex = new TypeMismatchException("value", ITestBean.class, cause);
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
@@ -126,7 +126,7 @@ class ResponseStatusExceptionResolverTests {
}
@Test // SPR-15524
public void responseStatusExceptionWithReason() {
void responseStatusExceptionWithReason() {
ResponseStatusException ex = new ResponseStatusException(HttpStatus.BAD_REQUEST, "The reason");
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
assertResolved(mav, 400, "The reason");
@@ -89,7 +89,7 @@ class ConsumesRequestConditionTests {
}
@Test // gh-28024
public void matchWithParameters() {
void matchWithParameters() {
String base = "application/hal+json";
ConsumesRequestCondition condition = new ConsumesRequestCondition(base + ";profile=\"a\"");
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -134,7 +134,7 @@ class ConsumesRequestConditionTests {
}
@Test // gh-22010
public void consumesNoContent() {
void consumesNoContent() {
ConsumesRequestCondition condition = new ConsumesRequestCondition("text/plain");
condition.setBodyRequired(false);
@@ -131,7 +131,7 @@ class HeadersRequestConditionTests {
}
@Test // SPR-16674
public void compareToWithMoreSpecificMatchByValue() {
void compareToWithMoreSpecificMatchByValue() {
MockHttpServletRequest request = new MockHttpServletRequest();
HeadersRequestCondition condition1 = new HeadersRequestCondition("foo=a");
@@ -95,7 +95,7 @@ class ProducesRequestConditionTests {
}
@Test // gh-21670
public void matchWithParameters() {
void matchWithParameters() {
String base = "application/atom+xml";
ProducesRequestCondition condition = new ProducesRequestCondition(base + ";type=feed");
HttpServletRequest request = createRequest(base + ";type=entry");
@@ -141,7 +141,7 @@ class ProducesRequestConditionTests {
}
@Test // SPR-17550
public void matchWithNegationAndMediaTypeAllWithQualityParameter() {
void matchWithNegationAndMediaTypeAllWithQualityParameter() {
ProducesRequestCondition condition = new ProducesRequestCondition("!application/json");
HttpServletRequest request = createRequest(
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
@@ -150,7 +150,7 @@ class ProducesRequestConditionTests {
}
@Test // gh-22853
public void matchAndCompare() {
void matchAndCompare() {
ContentNegotiationManager manager = new ContentNegotiationManager(
new HeaderContentNegotiationStrategy(),
new FixedContentNegotiationStrategy(MediaType.TEXT_HTML));
@@ -85,7 +85,7 @@ class RequestMethodsRequestConditionTests {
}
@Test // SPR-14410
public void getMatchingConditionWithHttpOptionsInErrorDispatch() {
void getMatchingConditionWithHttpOptionsInErrorDispatch() {
MockHttpServletRequest request = new MockHttpServletRequest("OPTIONS", "/path");
request.setDispatcherType(DispatcherType.ERROR);
@@ -64,7 +64,7 @@ class DeferredResultReturnValueHandlerTests {
@Test
@SuppressWarnings({"deprecation", "removal"})
public void supportsReturnType() throws Exception {
void supportsReturnType() throws Exception {
assertThat(this.handler.supportsReturnType(
on(TestController.class).resolveReturnType(DeferredResult.class, String.class))).isTrue();
@@ -117,7 +117,7 @@ public class HttpEntityMethodProcessorTests {
}
@Test // SPR-12861
public void resolveArgumentWithEmptyBody() throws Exception {
void resolveArgumentWithEmptyBody() throws Exception {
this.servletRequest.setContent(new byte[0]);
this.servletRequest.setContentType("application/json");
@@ -194,7 +194,7 @@ public class HttpEntityMethodProcessorTests {
}
@Test // SPR-12811
public void jacksonTypeInfoList() throws Exception {
void jacksonTypeInfoList() throws Exception {
Method method = JacksonController.class.getMethod("handleList");
HandlerMethod handlerMethod = new HandlerMethod(new JacksonController(), method);
MethodParameter methodReturnType = handlerMethod.getReturnType();
@@ -212,7 +212,7 @@ public class HttpEntityMethodProcessorTests {
}
@Test // SPR-13423
public void handleReturnValueCharSequence() throws Exception {
void handleReturnValueCharSequence() throws Exception {
List<HttpMessageConverter<?>>converters = new ArrayList<>();
converters.add(new ByteArrayHttpMessageConverter());
converters.add(new StringHttpMessageConverter());
@@ -229,7 +229,7 @@ public class HttpEntityMethodProcessorTests {
}
@Test // SPR-13423
public void handleReturnValueWithETagAndETagFilter() throws Exception {
void handleReturnValueWithETagAndETagFilter() throws Exception {
String eTagValue = "\"deadb33f8badf00d\"";
String content = "body";
@@ -263,7 +263,7 @@ public class HttpEntityMethodProcessorTests {
}
@Test // gh-24539
public void handleReturnValueWithMalformedAcceptHeader() throws Exception {
void handleReturnValueWithMalformedAcceptHeader() throws Exception {
webRequest.getNativeRequest(MockHttpServletRequest.class).addHeader("Accept", "null");
List<HttpMessageConverter<?>>converters = new ArrayList<>();
@@ -169,7 +169,7 @@ class ModelAndViewMethodReturnValueHandlerTests {
}
@Test // SPR-14045
public void handleRedirectWithIgnoreDefaultModel() throws Exception {
void handleRedirectWithIgnoreDefaultModel() throws Exception {
RedirectView redirectView = new RedirectView();
ModelAndView mav = new ModelAndView(redirectView, "name", "value");
handler.handleReturnValue(mav, returnParamModelAndView, mavContainer, webRequest);
@@ -252,14 +252,14 @@ public class MvcUriComponentsBuilderTests {
}
@Test // SPR-12977
public void fromMethodNameWithBridgedMethod() {
void fromMethodNameWithBridgedMethod() {
UriComponents uriComponents = fromMethodName(PersonCrudController.class, "get", (long) 42).build();
assertThat(uriComponents.toUriString()).isEqualTo("http://localhost/42");
}
@Test // SPR-11391
public void fromMethodNameTypeLevelPathVariableWithoutArgumentValue() {
void fromMethodNameTypeLevelPathVariableWithoutArgumentValue() {
UriComponents uriComponents = fromMethodName(UserContactController.class, "showCreate", 123).build();
assertThat(uriComponents.getPath()).isEqualTo("/user/123/contacts/create");
@@ -273,7 +273,7 @@ public class MvcUriComponentsBuilderTests {
}
@Test // gh-29897
public void fromMethodNameInUnmappedControllerMethod() {
void fromMethodNameInUnmappedControllerMethod() {
UriComponents uriComponents = fromMethodName(UnmappedControllerMethod.class, "getMethod").build();
assertThat(uriComponents.toUriString()).isEqualTo("http://localhost/path");
@@ -301,7 +301,7 @@ public class MvcUriComponentsBuilderTests {
}
@Test // SPR-14405
public void fromMethodNameWithOptionalParam() {
void fromMethodNameWithOptionalParam() {
UriComponents uriComponents = fromMethodName(ControllerWithMethods.class,
"methodWithOptionalParam", new Object[] {null}).build();
@@ -309,7 +309,7 @@ public class MvcUriComponentsBuilderTests {
}
@Test // gh-22656
public void fromMethodNameWithOptionalNamedParam() {
void fromMethodNameWithOptionalNamedParam() {
UriComponents uriComponents = fromMethodName(ControllerWithMethods.class,
"methodWithOptionalNamedParam", Optional.of("foo")).build();
@@ -444,7 +444,7 @@ public class MvcUriComponentsBuilderTests {
}
@Test // SPR-16710
public void fromMethodCallWithModelAndViewReturnType() {
void fromMethodCallWithModelAndViewReturnType() {
UriComponents uriComponents = fromMethodCall(
on(BookingControllerWithModelAndView.class).getBooking(21L)).buildAndExpand(42);
@@ -452,7 +452,7 @@ public class MvcUriComponentsBuilderTests {
}
@Test // SPR-16710
public void fromMethodCallWithObjectReturnType() {
void fromMethodCallWithObjectReturnType() {
UriComponents uriComponents = fromMethodCall(
on(BookingControllerWithObject.class).getBooking(21L)).buildAndExpand(42);
@@ -460,7 +460,7 @@ public class MvcUriComponentsBuilderTests {
}
@Test // SPR-16710
public void fromMethodCallWithStringReturnType() {
void fromMethodCallWithStringReturnType() {
assertThatIllegalStateException().isThrownBy(() -> {
UriComponents uriComponents = fromMethodCall(
on(BookingControllerWithString.class).getBooking(21L)).buildAndExpand(42);
@@ -469,7 +469,7 @@ public class MvcUriComponentsBuilderTests {
}
@Test // SPR-16710
public void fromMethodNameWithStringReturnType() {
void fromMethodNameWithStringReturnType() {
UriComponents uriComponents = fromMethodName(
BookingControllerWithString.class, "getBooking", 21L).buildAndExpand(42);
@@ -477,7 +477,7 @@ public class MvcUriComponentsBuilderTests {
}
@Test // gh-30210
public void fromMethodCallWithCharSequenceReturnType() {
void fromMethodCallWithCharSequenceReturnType() {
UriComponents uriComponents = fromMethodCall(
on(BookingControllerWithCharSequence.class).getBooking(21L)).buildAndExpand(42);
@@ -485,7 +485,7 @@ public class MvcUriComponentsBuilderTests {
}
@Test // gh-30210
public void fromMethodCallWithJdbc30115ReturnType() {
void fromMethodCallWithJdbc30115ReturnType() {
UriComponents uriComponents = fromMethodCall(
on(BookingControllerWithJdbcSavepoint.class).getBooking(21L)).buildAndExpand(42);
@@ -516,7 +516,7 @@ public class MvcUriComponentsBuilderTests {
}
@Test // SPR-17027
public void fromMappingNameWithEncoding() {
void fromMappingNameWithEncoding() {
initWebApplicationContext(WebConfig.class);
this.request.setServerName("example.org");
@@ -89,7 +89,7 @@ class PathVariableMapMethodArgumentResolverTests {
@Test
@SuppressWarnings("unchecked")
public void resolveArgumentNoUriVars() throws Exception {
void resolveArgumentNoUriVars() throws Exception {
Map<String, String> map = (Map<String, String>) resolver.resolveArgument(paramMap, mavContainer, webRequest, null);
assertThat(map).isEqualTo(Collections.emptyMap());
@@ -279,7 +279,7 @@ class RequestMappingHandlerAdapterTests {
}
@Test // gh-15486
public void responseBodyAdvice() throws Exception {
void responseBodyAdvice() throws Exception {
List<HttpMessageConverter<?>> converters = new ArrayList<>();
converters.add(new MappingJackson2HttpMessageConverter());
this.handlerAdapter.setMessageConverters(converters);
@@ -299,7 +299,7 @@ class RequestMappingHandlerAdapterTests {
}
@Test // gh-30522
public void responseBodyAdviceWithEmptyBody() throws Exception {
void responseBodyAdviceWithEmptyBody() throws Exception {
this.webAppContext.registerBean("rba", EmptyBodyAdvice.class);
this.webAppContext.refresh();
@@ -203,7 +203,7 @@ class ResponseEntityExceptionHandlerTests {
}
@Test // gh-30300
public void reasonAsDetailShouldBeUpdatedViaMessageSource() {
void reasonAsDetailShouldBeUpdatedViaMessageSource() {
Locale locale = Locale.UK;
LocaleContextHolder.setLocale(locale);
@@ -262,7 +262,7 @@ class ResponseEntityExceptionHandlerTests {
@Test
@SuppressWarnings("deprecation")
public void httpMessageNotReadable() {
void httpMessageNotReadable() {
testException(new HttpMessageNotReadableException("message"));
}
@@ -1616,7 +1616,7 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
}
@PathPatternsParameterizedTest
void testMatchWithoutMethodLevelPath(boolean usePathPatterns) throws Exception {
void matchWithoutMethodLevelPath(boolean usePathPatterns) throws Exception {
initDispatcherServlet(NoPathGetAndM2PostController.class, usePathPatterns);
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/t1/m2");
@@ -1626,7 +1626,7 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
}
@PathPatternsParameterizedTest // SPR-8536
void testHeadersCondition(boolean usePathPatterns) throws Exception {
void headersCondition(boolean usePathPatterns) throws Exception {
initDispatcherServlet(HeadersConditionController.class, usePathPatterns);
// No "Accept" header
@@ -80,7 +80,7 @@ class ServletCookieValueMethodArgumentResolverTests {
}
@Test // gh-26989
public void resolveCookieWithEncodingTurnedOff() throws Exception {
void resolveCookieWithEncodingTurnedOff() throws Exception {
Cookie cookie = new Cookie("name", "Tl=Q/0AUSOx[n)2z4(t]20FZv#?[Ge%H");
request.setCookies(cookie);
@@ -175,7 +175,7 @@ class ServletInvocableHandlerMethodTests {
}
@Test // SPR-9159
public void invokeAndHandle_NotVoidWithResponseStatusAndReason() throws Exception {
void invokeAndHandle_NotVoidWithResponseStatusAndReason() throws Exception {
ServletInvocableHandlerMethod handlerMethod = getHandlerMethod(new Handler(), "responseStatusWithReason");
handlerMethod.invokeAndHandle(this.webRequest, this.mavContainer);
@@ -218,7 +218,7 @@ class ServletInvocableHandlerMethodTests {
}
@Test // gh-23775, gh-24635
public void invokeAndHandle_ETagFilterHasNoImpactWhenETagPresent() throws Exception {
void invokeAndHandle_ETagFilterHasNoImpactWhenETagPresent() throws Exception {
String eTagValue = "\"deadb33f8badf00d\"";
@@ -326,7 +326,7 @@ class ServletInvocableHandlerMethodTests {
}
@Test // SPR-12287
public void wrapConcurrentResult_ResponseEntityNullBody() throws Exception {
void wrapConcurrentResult_ResponseEntityNullBody() throws Exception {
this.returnValueHandlers.addHandler(new HttpEntityMethodProcessor(this.converters));
ServletInvocableHandlerMethod handlerMethod = getHandlerMethod(new ResponseEntityHandler(), "handleDeferred");
handlerMethod = handlerMethod.wrapConcurrentResult(new ResponseEntity<>(HttpStatus.OK));
@@ -390,7 +390,7 @@ class ServletInvocableHandlerMethodTests {
}
@Test // SPR-15478
public void wrapConcurrentResult_CollectedValuesListWithResponseEntity() throws Exception {
void wrapConcurrentResult_CollectedValuesListWithResponseEntity() throws Exception {
List<HttpMessageConverter<?>> converters = Collections.singletonList(new MappingJackson2HttpMessageConverter());
ResolvableType elementType = ResolvableType.forClass(Bar.class);
ReactiveTypeHandler.CollectedValuesList result = new ReactiveTypeHandler.CollectedValuesList(elementType);
@@ -408,7 +408,7 @@ class ServletInvocableHandlerMethodTests {
}
@Test // SPR-12287 (16/Oct/14 comments)
public void responseEntityRawTypeWithNullBody() throws Exception {
void responseEntityRawTypeWithNullBody() throws Exception {
this.returnValueHandlers.addHandler(new HttpEntityMethodProcessor(this.converters));
ServletInvocableHandlerMethod handlerMethod = getHandlerMethod(new ResponseEntityHandler(), "handleRawType");
handlerMethod.invokeAndHandle(this.webRequest, this.mavContainer);
@@ -108,7 +108,7 @@ class ServletModelAttributeMethodProcessorTests {
@Test
@SuppressWarnings("unchecked")
public void createAttributeUriTemplateVarWithOptional() throws Exception {
void createAttributeUriTemplateVarWithOptional() throws Exception {
Map<String, String> uriTemplateVars = new HashMap<>();
uriTemplateVars.put("testBean3", "Patty");
request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars);
@@ -143,7 +143,7 @@ class ServletModelAttributeMethodProcessorTests {
@Test
@SuppressWarnings("unchecked")
public void createAttributeRequestParameterWithOptional() throws Exception {
void createAttributeRequestParameterWithOptional() throws Exception {
request.addParameter("testBean3", "Patty");
Optional<TestBean> testBean = (Optional<TestBean>) processor.resolveArgument(
@@ -154,7 +154,7 @@ class ServletModelAttributeMethodProcessorTests {
@Test
@SuppressWarnings("unchecked")
public void attributesAsNullValues() throws Exception {
void attributesAsNullValues() throws Exception {
request.addParameter("name", "Patty");
mavContainer.getModel().put("testBean1", null);
@@ -174,7 +174,7 @@ class ServletModelAttributeMethodProcessorTests {
@Test
@SuppressWarnings("unchecked")
public void attributesAsOptionalEmpty() throws Exception {
void attributesAsOptionalEmpty() throws Exception {
request.addParameter("name", "Patty");
mavContainer.getModel().put("testBean1", Optional.empty());
@@ -126,7 +126,7 @@ class ServletRequestMethodArgumentResolverTests {
}
@Test // gh-25780
public void annotatedPrincipal() throws Exception {
void annotatedPrincipal() throws Exception {
Principal principal = () -> "Foo";
servletRequest.setUserPrincipal(principal);
Method principalMethod = getClass().getMethod("supportedParamsWithAnnotatedPrincipal", Principal.class);
@@ -72,7 +72,7 @@ class ServletResponseMethodArgumentResolverTests {
}
@Test // SPR-8983
public void servletResponseNoMavContainer() throws Exception {
void servletResponseNoMavContainer() throws Exception {
MethodParameter servletResponseParameter = new MethodParameter(method, 0);
assertThat(resolver.supportsParameter(servletResponseParameter)).as("ServletResponse not supported").isTrue();
@@ -154,7 +154,7 @@ class DefaultHandlerExceptionResolverTests {
@Test
@SuppressWarnings("deprecation")
public void handleHttpMessageNotReadable() {
void handleHttpMessageNotReadable() {
HttpMessageNotReadableException ex = new HttpMessageNotReadableException("foo");
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
assertThat(mav).as("No ModelAndView returned").isNotNull();
@@ -230,7 +230,7 @@ class DefaultHandlerExceptionResolverTests {
}
@Test // SPR-14669
public void handleAsyncRequestTimeoutException() {
void handleAsyncRequestTimeoutException() {
Exception ex = new AsyncRequestTimeoutException();
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
assertThat(mav).as("No ModelAndView returned").isNotNull();
@@ -124,7 +124,7 @@ public class EncodedResourceResolverTests {
}
@Test // SPR-13149
public void resolveWithNullRequest() {
void resolveWithNullRequest() {
String file = "js/foo.js";
Resource resolved = this.resolver.resolveResource(null, file, this.locations);
@@ -67,7 +67,7 @@ class FixedVersionStrategyTests {
}
@Test // SPR-13727
public void addVersionRelativePath() {
void addVersionRelativePath() {
String relativePath = "../" + PATH;
assertThat(this.strategy.addVersion(relativePath, VERSION)).isEqualTo(relativePath);
}
@@ -66,30 +66,30 @@ class PathResourceResolverTests {
@Test
void checkResource() {
Resource location = new ClassPathResource("test/", PathResourceResolver.class);
testCheckResource(location, "../testsecret/secret.txt");
testCheckResource(location, "test/../../testsecret/secret.txt");
checkResource(location, "../testsecret/secret.txt");
checkResource(location, "test/../../testsecret/secret.txt");
location = new UrlResource(getClass().getResource("./test/"));
String secretPath = new UrlResource(getClass().getResource("testsecret/secret.txt")).getURL().getPath();
testCheckResource(location, "file:" + secretPath);
testCheckResource(location, "/file:" + secretPath);
testCheckResource(location, "/" + secretPath);
testCheckResource(location, "////../.." + secretPath);
testCheckResource(location, "/%2E%2E/testsecret/secret.txt");
testCheckResource(location, "/%2e%2e/testsecret/secret.txt");
testCheckResource(location, " " + secretPath);
testCheckResource(location, "/ " + secretPath);
testCheckResource(location, "url:" + secretPath);
checkResource(location, "file:" + secretPath);
checkResource(location, "/file:" + secretPath);
checkResource(location, "/" + secretPath);
checkResource(location, "////../.." + secretPath);
checkResource(location, "/%2E%2E/testsecret/secret.txt");
checkResource(location, "/%2e%2e/testsecret/secret.txt");
checkResource(location, " " + secretPath);
checkResource(location, "/ " + secretPath);
checkResource(location, "url:" + secretPath);
}
private void testCheckResource(Resource location, String requestPath) {
private void checkResource(Resource location, String requestPath) {
List<Resource> locations = Collections.singletonList(location);
Resource actual = this.resolver.resolveResource(null, requestPath, locations, null);
assertThat(actual).isNull();
}
@Test // gh-23463
public void ignoreInvalidEscapeSequence() throws IOException {
void ignoreInvalidEscapeSequence() throws IOException {
UrlResource location = new UrlResource(getClass().getResource("./test/"));
Resource resource = new UrlResource(location.getURL() + "test%file.txt");
@@ -113,7 +113,7 @@ class PathResourceResolverTests {
}
@Test // SPR-12432
public void checkServletContextResource() throws Exception {
void checkServletContextResource() throws Exception {
Resource classpathLocation = new ClassPathResource("test/", PathResourceResolver.class);
MockServletContext context = new MockServletContext();
@@ -125,7 +125,7 @@ class PathResourceResolverTests {
}
@Test // SPR-12624
public void checkRelativeLocation() throws Exception {
void checkRelativeLocation() throws Exception {
String location= new UrlResource(getClass().getResource("./test/")).getURL().toExternalForm();
location = location.replace("/test/org/springframework","/test/org/../org/springframework");
@@ -136,13 +136,13 @@ class PathResourceResolverTests {
}
@Test // SPR-12747
public void checkFileLocation() throws Exception {
void checkFileLocation() throws Exception {
Resource resource = getResource("main.css");
assertThat(this.resolver.checkResource(resource, resource)).isTrue();
}
@Test // SPR-13241
public void resolvePathRootResource() {
void resolvePathRootResource() {
Resource webjarsLocation = new ClassPathResource("/META-INF/resources/webjars/", PathResourceResolver.class);
String path = this.resolver.resolveUrlPathInternal("", Collections.singletonList(webjarsLocation), null);
@@ -202,7 +202,7 @@ class ResourceHttpRequestHandlerTests {
}
@Test
void testResourceNotFound() {
void resourceNotFound() {
for (HttpMethod method : HttpMethod.values()) {
this.request = new MockHttpServletRequest("GET", "");
this.request.setAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, "not-there.css");
@@ -104,7 +104,7 @@ class ResourceUrlEncodingFilterTests {
}
@Test // SPR-13757
public void encodeContextPathUrlWithoutSuffix() throws Exception {
void encodeContextPathUrlWithoutSuffix() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/context");
request.setContextPath("/context");
@@ -122,7 +122,7 @@ class ResourceUrlEncodingFilterTests {
}
@Test // SPR-13018
public void encodeEmptyUrlWithContext() throws Exception {
void encodeEmptyUrlWithContext() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/context/foo");
request.setContextPath("/context");
@@ -130,7 +130,7 @@ class ResourceUrlEncodingFilterTests {
}
@Test // SPR-13374
public void encodeUrlWithRequestParams() throws Exception {
void encodeUrlWithRequestParams() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo");
request.setContextPath("/");
@@ -139,7 +139,7 @@ class ResourceUrlEncodingFilterTests {
}
@Test // SPR-13847
public void encodeUrlPreventStringOutOfBounds() throws Exception {
void encodeUrlPreventStringOutOfBounds() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/context-path/index");
request.setContextPath("/context-path");
request.setServletPath("");
@@ -148,7 +148,7 @@ class ResourceUrlEncodingFilterTests {
}
@Test // SPR-17535
public void encodeUrlWithFragment() throws Exception {
void encodeUrlWithFragment() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo");
request.setContextPath("/");
@@ -161,7 +161,7 @@ class ResourceUrlEncodingFilterTests {
}
@Test // gh-23508
public void invalidLookupPath() throws Exception {
void invalidLookupPath() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setRequestURI("/a/b/../logo.png");
request.setServletPath("/a/logo.png");
@@ -108,7 +108,7 @@ class ResourceUrlProviderJavaConfigTests {
static class WebConfig extends WebMvcConfigurationSupport {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**")
.addResourceLocations("classpath:org/springframework/web/servlet/resource/test/")
.resourceChain(true).addResolver(new VersionResourceResolver().addContentVersionStrategy("/**"));
@@ -67,7 +67,7 @@ class FlashMapManagerTests {
}
@Test // SPR-8779
public void retrieveAndUpdateMatchByOriginatingPath() {
void retrieveAndUpdateMatchByOriginatingPath() {
FlashMap flashMap = new FlashMap();
flashMap.put("key", "value");
flashMap.setTargetRequestPath("/accounts");
@@ -125,7 +125,7 @@ class FlashMapManagerTests {
}
@Test // SPR-8798
public void retrieveAndUpdateMatchWithMultiValueParam() {
void retrieveAndUpdateMatchWithMultiValueParam() {
FlashMap flashMap = new FlashMap();
flashMap.put("name", "value");
flashMap.addTargetRequestParam("id", "1");
@@ -255,7 +255,7 @@ class FlashMapManagerTests {
}
@Test // gh-23240
public void saveOutputFlashMapAndNormalizeEmptyTargetPath() {
void saveOutputFlashMapAndNormalizeEmptyTargetPath() {
FlashMap flashMap = new FlashMap();
flashMap.put("key", "value");
@@ -266,7 +266,7 @@ class FlashMapManagerTests {
}
@Test // SPR-9657, SPR-11504
public void saveOutputFlashMapDecodeParameters() {
void saveOutputFlashMapDecodeParameters() {
FlashMap flashMap = new FlashMap();
flashMap.put("key", "value");
flashMap.setTargetRequestPath("/path");
@@ -293,7 +293,7 @@ class FlashMapManagerTests {
}
@Test // SPR-12569
public void flashAttributesWithQueryParamsWithSpace() {
void flashAttributesWithQueryParamsWithSpace() {
String encodedValue = URLEncoder.encode("1 2", StandardCharsets.UTF_8);
FlashMap flashMap = new FlashMap();
@@ -315,7 +315,7 @@ class FlashMapManagerTests {
}
@Test // SPR-15505
public void retrieveAndUpdateMatchByOriginatingPathAndQueryString() {
void retrieveAndUpdateMatchByOriginatingPathAndQueryString() {
FlashMap flashMap = new FlashMap();
flashMap.put("key", "value");
flashMap.setTargetRequestPath("/accounts");
@@ -53,14 +53,14 @@ class RequestContextTests {
}
@Test
void testGetContextUrl() {
void getContextUrl() {
request.setContextPath("foo/");
RequestContext context = new RequestContext(request, response, servletContext, model);
assertThat(context.getContextUrl("bar")).isEqualTo("foo/bar");
}
@Test
void testGetContextUrlWithMap() {
void getContextUrlWithMap() {
request.setContextPath("foo/");
RequestContext context = new RequestContext(request, response, servletContext, model);
Map<String, Object> map = new HashMap<>();
@@ -70,7 +70,7 @@ class RequestContextTests {
}
@Test
void testGetContextUrlWithMapEscaping() {
void getContextUrlWithMapEscaping() {
request.setContextPath("foo/");
RequestContext context = new RequestContext(request, response, servletContext, model);
Map<String, Object> map = new HashMap<>();
@@ -80,7 +80,7 @@ class RequestContextTests {
}
@Test
void testPathToServlet() {
void pathToServlet() {
request.setContextPath("/app");
request.setServletPath("/servlet");
RequestContext context = new RequestContext(request, response, servletContext, model);
@@ -109,7 +109,7 @@ class ServletUriComponentsBuilderTests {
}
@Test // SPR-16650
public void fromRequestWithForwardedPrefix() throws Exception {
void fromRequestWithForwardedPrefix() throws Exception {
this.request.addHeader("X-Forwarded-Prefix", "/prefix");
this.request.setContextPath("/mvc-showcase");
this.request.setRequestURI("/mvc-showcase/bar");
@@ -121,7 +121,7 @@ class ServletUriComponentsBuilderTests {
}
@Test // SPR-16650
public void fromRequestWithForwardedPrefixTrailingSlash() throws Exception {
void fromRequestWithForwardedPrefixTrailingSlash() throws Exception {
this.request.addHeader("X-Forwarded-Prefix", "/foo/");
this.request.setContextPath("/spring-mvc-showcase");
this.request.setRequestURI("/spring-mvc-showcase/bar");
@@ -133,7 +133,7 @@ class ServletUriComponentsBuilderTests {
}
@Test // SPR-16650
public void fromRequestWithForwardedPrefixRoot() throws Exception {
void fromRequestWithForwardedPrefixRoot() throws Exception {
this.request.addHeader("X-Forwarded-Prefix", "/");
this.request.setContextPath("/mvc-showcase");
this.request.setRequestURI("/mvc-showcase/bar");
@@ -153,7 +153,7 @@ class ServletUriComponentsBuilderTests {
}
@Test // SPR-16650
public void fromContextPathWithForwardedPrefix() throws Exception {
void fromContextPathWithForwardedPrefix() throws Exception {
this.request.addHeader("X-Forwarded-Prefix", "/prefix");
this.request.setContextPath("/mvc-showcase");
this.request.setRequestURI("/mvc-showcase/simple");
@@ -174,7 +174,7 @@ class ServletUriComponentsBuilderTests {
}
@Test // SPR-16650
public void fromServletMappingWithForwardedPrefix() throws Exception {
void fromServletMappingWithForwardedPrefix() throws Exception {
this.request.addHeader("X-Forwarded-Prefix", "/prefix");
this.request.setContextPath("/mvc-showcase");
this.request.setServletPath("/app");
@@ -201,7 +201,7 @@ class ServletUriComponentsBuilderTests {
}
@Test // SPR-10272
public void pathExtension() {
void pathExtension() {
this.request.setRequestURI("/rest/books/6.json");
ServletUriComponentsBuilder builder = ServletUriComponentsBuilder.fromRequestUri(this.request);
String extension = builder.removePathExtension();
@@ -139,7 +139,7 @@ class EvalTagTests extends AbstractTagTests {
}
@Test // SPR-6923
public void nestedPropertyWithAttributeName() throws Exception {
void nestedPropertyWithAttributeName() throws Exception {
tag.setExpression("bean.bean");
tag.setVar("foo");
int action = tag.doStartTag();
@@ -41,7 +41,7 @@ class HtmlEscapeTagTests extends AbstractTagTests {
tag.doStartTag();
HtmlEscapingAwareTag testTag = new HtmlEscapingAwareTag() {
@Override
public int doStartTagInternal() {
protected int doStartTagInternal() {
return EVAL_BODY_INCLUDE;
}
};
@@ -415,7 +415,7 @@ class UrlTagTests extends AbstractTagTests {
}
@Test // SPR-11401
public void replaceUriTemplateParamsTemplateWithPathSegment() throws JspException {
void replaceUriTemplateParamsTemplateWithPathSegment() throws JspException {
List<Param> params = new ArrayList<>();
Set<String> usedParams = new HashSet<>();
@@ -57,7 +57,7 @@ class OptionTagEnumTests extends AbstractHtmlElementTagTests {
@Test
@SuppressWarnings("rawtypes")
public void withJavaEnum() throws Exception {
void withJavaEnum() throws Exception {
GenericBean testBean = new GenericBean();
testBean.setCustomEnum(CustomEnum.VALUE_1);
getPageContext().getRequest().setAttribute("testBean", testBean);
@@ -77,7 +77,7 @@ class PasswordInputTagTests extends InputTagTests {
@Test
@Override
public void dynamicTypeAttribute() {
void dynamicTypeAttribute() {
assertThatIllegalArgumentException()
.isThrownBy(() -> getTag().setDynamicAttribute(null, "type", "email"))
.withMessage("Attribute type=\"email\" is not allowed");
@@ -196,7 +196,7 @@ class RedirectViewTests {
}
@Test // SPR-13693
public void remoteHost() {
void remoteHost() {
RedirectView rv = new RedirectView();
assertThat(rv.isRemoteHost("https://url.somewhere.com")).isFalse();
@@ -211,7 +211,7 @@ class RedirectViewTests {
}
@Test // SPR-16752
public void contextRelativeWithValidatedContextPath() throws Exception {
void contextRelativeWithValidatedContextPath() throws Exception {
String url = "/myUrl";
this.request.setContextPath("//context");
@@ -50,7 +50,7 @@ class XlsViewTests {
@Test
void testXls() throws Exception {
void xls() throws Exception {
View excelView = new AbstractXlsView() {
@Override
protected void buildExcelDocument(Map<String, Object> model, Workbook workbook,
@@ -73,7 +73,7 @@ class XlsViewTests {
}
@Test
void testXlsxView() throws Exception {
void xlsxView() throws Exception {
View excelView = new AbstractXlsxView() {
@Override
protected void buildExcelDocument(Map<String, Object> model, Workbook workbook,
@@ -96,7 +96,7 @@ class XlsViewTests {
}
@Test
void testXlsxStreamingView() throws Exception {
void xlsxStreamingView() throws Exception {
View excelView = new AbstractXlsxStreamingView() {
@Override
protected void buildExcelDocument(Map<String, Object> model, Workbook workbook,
@@ -66,7 +66,7 @@ class FreeMarkerConfigurerTests {
@Test
@SuppressWarnings("rawtypes")
public void freeMarkerConfigurerWithNonFileResourceLoaderPath() throws Exception {
void freeMarkerConfigurerWithNonFileResourceLoaderPath() throws Exception {
freeMarkerConfigurer.setTemplateLoaderPath("file:/mydir");
Properties settings = new Properties();
settings.setProperty("localized_lookup", "false");
@@ -93,7 +93,7 @@ public class FreeMarkerMacroTests {
@Test
void testExposeSpringMacroHelpers() throws Exception {
void exposeSpringMacroHelpers() throws Exception {
FreeMarkerView fv = new FreeMarkerView() {
@Override
@SuppressWarnings("rawtypes")
@@ -116,7 +116,7 @@ public class FreeMarkerMacroTests {
}
@Test
void testSpringMacroRequestContextAttributeUsed() {
void springMacroRequestContextAttributeUsed() {
final String helperTool = "wrongType";
FreeMarkerView fv = new FreeMarkerView() {
@@ -141,109 +141,109 @@ public class FreeMarkerMacroTests {
}
@Test
void testName() throws Exception {
void name() throws Exception {
assertThat(getMacroOutput("NAME")).isEqualTo("Darren");
}
@Test
void testMessage() throws Exception {
void message() throws Exception {
assertThat(getMacroOutput("MESSAGE")).isEqualTo("Howdy Mundo");
}
@Test
void testDefaultMessage() throws Exception {
void defaultMessage() throws Exception {
assertThat(getMacroOutput("DEFAULTMESSAGE")).isEqualTo("hi planet");
}
@Test
void testMessageArgs() throws Exception {
void messageArgs() throws Exception {
assertThat(getMacroOutput("MESSAGEARGS")).isEqualTo("Howdy[World]");
}
@Test
void testMessageArgsWithDefaultMessage() throws Exception {
void messageArgsWithDefaultMessage() throws Exception {
assertThat(getMacroOutput("MESSAGEARGSWITHDEFAULTMESSAGE")).isEqualTo("Hi");
}
@Test
void testTheme() throws Exception {
void theme() throws Exception {
assertThat(getMacroOutput("THEME")).isEqualTo("Howdy! Mundo!");
}
@Test
void testDefaultTheme() throws Exception {
void defaultTheme() throws Exception {
assertThat(getMacroOutput("DEFAULTTHEME")).isEqualTo("hi! planet!");
}
@Test
void testThemeArgs() throws Exception {
void themeArgs() throws Exception {
assertThat(getMacroOutput("THEMEARGS")).isEqualTo("Howdy![World]");
}
@Test
void testThemeArgsWithDefaultMessage() throws Exception {
void themeArgsWithDefaultMessage() throws Exception {
assertThat(getMacroOutput("THEMEARGSWITHDEFAULTMESSAGE")).isEqualTo("Hi!");
}
@Test
void testUrl() throws Exception {
void url() throws Exception {
assertThat(getMacroOutput("URL")).isEqualTo("/springtest/aftercontext.html");
}
@Test
void testUrlParams() throws Exception {
void urlParams() throws Exception {
assertThat(getMacroOutput("URLPARAMS")).isEqualTo("/springtest/aftercontext/bar?spam=bucket");
}
@Test
void testForm1() throws Exception {
void form1() throws Exception {
assertThat(getMacroOutput("FORM1")).isEqualTo("<input type=\"text\" id=\"name\" name=\"name\" value=\"Darren\" >");
}
@Test
void testForm2() throws Exception {
void form2() throws Exception {
assertThat(getMacroOutput("FORM2")).isEqualTo("<input type=\"text\" id=\"name\" name=\"name\" value=\"Darren\" class=\"myCssClass\" >");
}
@Test
void testForm3() throws Exception {
void form3() throws Exception {
assertThat(getMacroOutput("FORM3")).isEqualTo("<textarea id=\"name\" name=\"name\" >\nDarren</textarea>");
}
@Test
void testForm4() throws Exception {
void form4() throws Exception {
assertThat(getMacroOutput("FORM4")).isEqualTo("<textarea id=\"name\" name=\"name\" rows=10 cols=30>\nDarren</textarea>");
}
// TODO verify remaining output for forms 5, 6, 7, 8, and 14 (fix whitespace)
@Test
void testForm9() throws Exception {
void form9() throws Exception {
assertThat(getMacroOutput("FORM9")).isEqualTo("<input type=\"password\" id=\"name\" name=\"name\" value=\"\" >");
}
@Test
void testForm10() throws Exception {
void form10() throws Exception {
assertThat(getMacroOutput("FORM10")).isEqualTo("<input type=\"hidden\" id=\"name\" name=\"name\" value=\"Darren\" >");
}
@Test
void testForm11() throws Exception {
void form11() throws Exception {
assertThat(getMacroOutput("FORM11")).isEqualTo("<input type=\"text\" id=\"name\" name=\"name\" value=\"Darren\" >");
}
@Test
void testForm12() throws Exception {
void form12() throws Exception {
assertThat(getMacroOutput("FORM12")).isEqualTo("<input type=\"hidden\" id=\"name\" name=\"name\" value=\"Darren\" >");
}
@Test
void testForm13() throws Exception {
void form13() throws Exception {
assertThat(getMacroOutput("FORM13")).isEqualTo("<input type=\"password\" id=\"name\" name=\"name\" value=\"\" >");
}
@Test
void testForm15() throws Exception {
void form15() throws Exception {
String output = getMacroOutput("FORM15");
assertThat(output).as("Wrong output: " + output)
.startsWith("<input type=\"hidden\" name=\"_name\" value=\"on\"/>");
@@ -252,7 +252,7 @@ public class FreeMarkerMacroTests {
}
@Test
void testForm16() throws Exception {
void form16() throws Exception {
String output = getMacroOutput("FORM16");
assertThat(output).as("Wrong output: " + output)
.startsWith("<input type=\"hidden\" name=\"_jedi\" value=\"on\"/>");
@@ -261,12 +261,12 @@ public class FreeMarkerMacroTests {
}
@Test
void testForm17() throws Exception {
void form17() throws Exception {
assertThat(getMacroOutput("FORM17")).isEqualTo("<input type=\"text\" id=\"spouses0.name\" name=\"spouses[0].name\" value=\"Fred\" >");
}
@Test
void testForm18() throws Exception {
void form18() throws Exception {
String output = getMacroOutput("FORM18");
assertThat(output).as("Wrong output: " + output)
.startsWith("<input type=\"hidden\" name=\"_spouses[0].jedi\" value=\"on\"/>");
@@ -75,7 +75,7 @@ public class ScriptTemplateViewTests {
@Test
public void missingTemplate() throws Exception {
void missingTemplate() throws Exception {
MockServletContext servletContext = new MockServletContext();
this.wac.setServletContext(servletContext);
this.wac.refresh();
@@ -88,14 +88,14 @@ public class ScriptTemplateViewTests {
}
@Test
public void missingScriptTemplateConfig() {
void missingScriptTemplateConfig() {
assertThatExceptionOfType(ApplicationContextException.class).isThrownBy(() ->
this.view.setApplicationContext(new StaticApplicationContext()))
.withMessageContaining("ScriptTemplateConfig");
}
@Test
public void detectScriptTemplateConfigWithEngine() {
void detectScriptTemplateConfigWithEngine() {
InvocableScriptEngine engine = mock(InvocableScriptEngine.class);
this.configurer.setEngine(engine);
this.configurer.setRenderObject("Template");
@@ -115,7 +115,7 @@ public class ScriptTemplateViewTests {
}
@Test
public void detectScriptTemplateConfigWithEngineName() {
void detectScriptTemplateConfigWithEngineName() {
this.configurer.setEngineName("jython");
this.configurer.setRenderObject("Template");
this.configurer.setRenderFunction("render");
@@ -131,7 +131,7 @@ public class ScriptTemplateViewTests {
}
@Test
public void customEngineAndRenderFunction() {
void customEngineAndRenderFunction() {
ScriptEngine engine = mock(InvocableScriptEngine.class);
given(engine.get("key")).willReturn("value");
this.view.setEngine(engine);
@@ -147,7 +147,7 @@ public class ScriptTemplateViewTests {
}
@Test
public void nonSharedEngine() throws Exception {
void nonSharedEngine() throws Exception {
int iterations = 20;
this.view.setEngineName("jython");
this.view.setRenderFunction("render");
@@ -166,13 +166,13 @@ public class ScriptTemplateViewTests {
}
@Test
public void nonInvocableScriptEngine() {
void nonInvocableScriptEngine() {
this.view.setEngine(mock(ScriptEngine.class));
this.view.setApplicationContext(this.wac);
}
@Test
public void nonInvocableScriptEngineWithRenderFunction() {
void nonInvocableScriptEngineWithRenderFunction() {
this.view.setEngine(mock(ScriptEngine.class));
this.view.setRenderFunction("render");
assertThatIllegalArgumentException().isThrownBy(() ->
@@ -180,7 +180,7 @@ public class ScriptTemplateViewTests {
}
@Test
public void engineAndEngineNameBothDefined() {
void engineAndEngineNameBothDefined() {
this.view.setEngine(mock(InvocableScriptEngine.class));
this.view.setEngineName("test");
this.view.setRenderFunction("render");
@@ -190,7 +190,7 @@ public class ScriptTemplateViewTests {
}
@Test // gh-23258
public void engineAndEngineSupplierBothDefined() {
void engineAndEngineSupplierBothDefined() {
ScriptEngine engine = mock(InvocableScriptEngine.class);
this.view.setEngineSupplier(() -> engine);
this.view.setEngine(engine);
@@ -201,7 +201,7 @@ public class ScriptTemplateViewTests {
}
@Test // gh-23258
public void engineNameAndEngineSupplierBothDefined() {
void engineNameAndEngineSupplierBothDefined() {
this.view.setEngineSupplier(() -> mock(InvocableScriptEngine.class));
this.view.setEngineName("test");
this.view.setRenderFunction("render");
@@ -211,7 +211,7 @@ public class ScriptTemplateViewTests {
}
@Test
public void engineSetterAndNonSharedEngine() {
void engineSetterAndNonSharedEngine() {
this.view.setEngine(mock(InvocableScriptEngine.class));
this.view.setRenderFunction("render");
this.view.setSharedEngine(false);
@@ -221,7 +221,7 @@ public class ScriptTemplateViewTests {
}
@Test // SPR-14210
public void resourceLoaderPath() throws Exception {
void resourceLoaderPath() throws Exception {
MockServletContext servletContext = new MockServletContext();
this.wac.setServletContext(servletContext);
this.wac.refresh();
@@ -259,7 +259,7 @@ public class ScriptTemplateViewTests {
}
@Test // SPR-13379
public void contentType() throws Exception {
void contentType() throws Exception {
MockServletContext servletContext = new MockServletContext();
this.wac.setServletContext(servletContext);
this.wac.refresh();
@@ -292,7 +292,7 @@ public class ScriptTemplateViewTests {
}
@Test // gh-23258
public void engineSupplierWithSharedEngine() {
void engineSupplierWithSharedEngine() {
this.configurer.setEngineSupplier(() -> mock(InvocableScriptEngine.class));
this.configurer.setRenderObject("Template");
this.configurer.setRenderFunction("render");
@@ -310,7 +310,7 @@ public class ScriptTemplateViewTests {
}
@Test // gh-23258
public void engineSupplierWithNonSharedEngine() {
void engineSupplierWithNonSharedEngine() {
this.configurer.setEngineSupplier(() -> mock(InvocableScriptEngine.class));
this.configurer.setRenderObject("Template");
this.configurer.setRenderFunction("render");
@@ -192,7 +192,7 @@ class MarshallingViewTests {
}
@Test
void testRenderUnsupportedModel() {
void renderUnsupportedModel() {
Object toBeMarshalled = new Object();
String modelKey = "key";
Map<String, Object> model = new HashMap<>();
@@ -81,34 +81,34 @@ class XsltViewTests {
}
@Test
void testSimpleTransformWithDocument() throws Exception {
void simpleTransformWithDocument() throws Exception {
org.w3c.dom.Document document = getDomDocument();
doTestWithModel(singletonMap("someKey", document));
}
@Test
void testSimpleTransformWithNode() throws Exception {
void simpleTransformWithNode() throws Exception {
org.w3c.dom.Document document = getDomDocument();
doTestWithModel(singletonMap("someKey", document.getDocumentElement()));
}
@Test
void testSimpleTransformWithInputStream() throws Exception {
void simpleTransformWithInputStream() throws Exception {
doTestWithModel(singletonMap("someKey", getProductDataResource().getInputStream()));
}
@Test
void testSimpleTransformWithReader() throws Exception {
void simpleTransformWithReader() throws Exception {
doTestWithModel(singletonMap("someKey", new InputStreamReader(getProductDataResource().getInputStream())));
}
@Test
void testSimpleTransformWithResource() throws Exception {
void simpleTransformWithResource() throws Exception {
doTestWithModel(singletonMap("someKey", getProductDataResource()));
}
@Test
void testWithSourceKey() throws Exception {
void withSourceKey() throws Exception {
XsltView view = getXsltView(HTML_OUTPUT);
view.setSourceKey("actualData");
@@ -121,7 +121,7 @@ class XsltViewTests {
}
@Test
void testContentTypeCarriedFromTemplate() throws Exception {
void contentTypeCarriedFromTemplate() throws Exception {
XsltView view = getXsltView(HTML_OUTPUT);
Source source = new StreamSource(getProductDataResource().getInputStream());
@@ -131,7 +131,7 @@ class XsltViewTests {
}
@Test
void testModelParametersCarriedAcross() throws Exception {
void modelParametersCarriedAcross() throws Exception {
Map<String, Object> model = new HashMap<>();
model.put("someKey", getProductDataResource());
model.put("title", "Product List");
@@ -140,7 +140,7 @@ class XsltViewTests {
}
@Test
void testStaticAttributesCarriedAcross() throws Exception {
void staticAttributesCarriedAcross() throws Exception {
XsltView view = getXsltView(HTML_OUTPUT);
view.setSourceKey("actualData");
view.addStaticAttribute("title", "Product List");