DelegatingWebMvcConfiguration properly delegates extendHandlerExceptionResolvers
Issue: SPR-14599
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
package org.springframework.web.servlet.config.annotation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -89,10 +89,10 @@ public class DelegatingWebMvcConfigurationTests {
|
||||
delegatingConfig = new DelegatingWebMvcConfiguration();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void requestMappingHandlerAdapter() throws Exception {
|
||||
|
||||
delegatingConfig.setConfigurers(Arrays.asList(webMvcConfigurer));
|
||||
delegatingConfig.setConfigurers(Collections.singletonList(webMvcConfigurer));
|
||||
RequestMappingHandlerAdapter adapter = delegatingConfig.requestMappingHandlerAdapter();
|
||||
|
||||
ConfigurableWebBindingInitializer initializer = (ConfigurableWebBindingInitializer) adapter.getWebBindingInitializer();
|
||||
@@ -141,7 +141,7 @@ public class DelegatingWebMvcConfigurationTests {
|
||||
public void getCustomValidator() {
|
||||
given(webMvcConfigurer.getValidator()).willReturn(new LocalValidatorFactoryBean());
|
||||
|
||||
delegatingConfig.setConfigurers(Arrays.asList(webMvcConfigurer));
|
||||
delegatingConfig.setConfigurers(Collections.singletonList(webMvcConfigurer));
|
||||
delegatingConfig.mvcValidator();
|
||||
|
||||
verify(webMvcConfigurer).getValidator();
|
||||
@@ -151,7 +151,7 @@ public class DelegatingWebMvcConfigurationTests {
|
||||
public void getCustomMessageCodesResolver() {
|
||||
given(webMvcConfigurer.getMessageCodesResolver()).willReturn(new DefaultMessageCodesResolver());
|
||||
|
||||
delegatingConfig.setConfigurers(Arrays.asList(webMvcConfigurer));
|
||||
delegatingConfig.setConfigurers(Collections.singletonList(webMvcConfigurer));
|
||||
delegatingConfig.getMessageCodesResolver();
|
||||
|
||||
verify(webMvcConfigurer).getMessageCodesResolver();
|
||||
@@ -159,8 +159,7 @@ public class DelegatingWebMvcConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void handlerExceptionResolver() throws Exception {
|
||||
|
||||
delegatingConfig.setConfigurers(Arrays.asList(webMvcConfigurer));
|
||||
delegatingConfig.setConfigurers(Collections.singletonList(webMvcConfigurer));
|
||||
delegatingConfig.handlerExceptionResolver();
|
||||
|
||||
verify(webMvcConfigurer).configureMessageConverters(converters.capture());
|
||||
@@ -186,7 +185,7 @@ public class DelegatingWebMvcConfigurationTests {
|
||||
delegatingConfig.setConfigurers(configurers);
|
||||
|
||||
HandlerExceptionResolverComposite composite =
|
||||
(HandlerExceptionResolverComposite) delegatingConfig.handlerExceptionResolver();
|
||||
(HandlerExceptionResolverComposite) delegatingConfig.handlerExceptionResolver();
|
||||
assertEquals("Only one custom converter is expected", 1, composite.getExceptionResolvers().size());
|
||||
}
|
||||
|
||||
@@ -200,9 +199,9 @@ public class DelegatingWebMvcConfigurationTests {
|
||||
@Override
|
||||
public void configurePathMatch(PathMatchConfigurer configurer) {
|
||||
configurer.setUseRegisteredSuffixPatternMatch(true)
|
||||
.setUseTrailingSlashMatch(false)
|
||||
.setUrlPathHelper(pathHelper)
|
||||
.setPathMatcher(pathMatcher);
|
||||
.setUseTrailingSlashMatch(false)
|
||||
.setUrlPathHelper(pathHelper)
|
||||
.setPathMatcher(pathMatcher);
|
||||
}
|
||||
});
|
||||
delegatingConfig.setConfigurers(configurers);
|
||||
|
||||
Reference in New Issue
Block a user