|
|
|
@ -93,7 +93,6 @@ import static org.junit.Assert.*; |
|
|
|
|
*/ |
|
|
|
|
public class WebMvcConfigurationSupportTests { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void requestMappingHandlerMapping() throws Exception { |
|
|
|
|
ApplicationContext context = initContext(WebConfig.class, ScopedController.class, ScopedProxyController.class); |
|
|
|
@ -208,10 +207,9 @@ public class WebMvcConfigurationSupportTests { |
|
|
|
|
public void handlerExceptionResolver() throws Exception { |
|
|
|
|
ApplicationContext context = initContext(WebConfig.class); |
|
|
|
|
HandlerExceptionResolverComposite compositeResolver = |
|
|
|
|
context.getBean("handlerExceptionResolver", HandlerExceptionResolverComposite.class); |
|
|
|
|
context.getBean("handlerExceptionResolver", HandlerExceptionResolverComposite.class); |
|
|
|
|
|
|
|
|
|
assertEquals(0, compositeResolver.getOrder()); |
|
|
|
|
|
|
|
|
|
List<HandlerExceptionResolver> expectedResolvers = compositeResolver.getExceptionResolvers(); |
|
|
|
|
|
|
|
|
|
assertEquals(ExceptionHandlerExceptionResolver.class, expectedResolvers.get(0).getClass()); |
|
|
|
@ -237,7 +235,6 @@ public class WebMvcConfigurationSupportTests { |
|
|
|
|
finally { |
|
|
|
|
LocaleContextHolder.resetLocaleContext(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@ -245,9 +242,6 @@ public class WebMvcConfigurationSupportTests { |
|
|
|
|
ApplicationContext context = initContext(WebConfig.class); |
|
|
|
|
ViewResolverComposite resolver = context.getBean("mvcViewResolver", ViewResolverComposite.class); |
|
|
|
|
|
|
|
|
|
Map<String, ViewResolver> map = BeanFactoryUtils.beansOfTypeIncludingAncestors( |
|
|
|
|
context, ViewResolver.class, true, false); |
|
|
|
|
|
|
|
|
|
assertNotNull(resolver); |
|
|
|
|
assertEquals(1, resolver.getViewResolvers().size()); |
|
|
|
|
assertEquals(InternalResourceViewResolver.class, resolver.getViewResolvers().get(0).getClass()); |
|
|
|
@ -317,6 +311,7 @@ public class WebMvcConfigurationSupportTests { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
|
public static class ViewResolverConfig { |
|
|
|
|
|
|
|
|
@ -326,6 +321,7 @@ public class WebMvcConfigurationSupportTests { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@EnableWebMvc |
|
|
|
|
@Configuration |
|
|
|
|
public static class CustomViewResolverOrderConfig extends WebMvcConfigurerAdapter { |
|
|
|
@ -337,6 +333,7 @@ public class WebMvcConfigurationSupportTests { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
|
public static class TestController { |
|
|
|
|
|
|
|
|
@ -371,6 +368,7 @@ public class WebMvcConfigurationSupportTests { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "exception.user.exists") |
|
|
|
|
public static class UserAlreadyExistsException extends RuntimeException { |
|
|
|
|
} |
|
|
|
|