Remove no-op classes in web-related Java config
This commit is contained in:
@@ -67,7 +67,6 @@ import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
import org.springframework.web.servlet.HandlerExceptionResolver;
|
||||
import org.springframework.web.servlet.HandlerExecutionChain;
|
||||
import org.springframework.web.servlet.ViewResolver;
|
||||
import org.springframework.web.servlet.handler.AbstractHandlerMapping;
|
||||
import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping;
|
||||
import org.springframework.web.servlet.handler.ConversionServiceExposingInterceptor;
|
||||
import org.springframework.web.servlet.handler.HandlerExceptionResolverComposite;
|
||||
@@ -85,13 +84,9 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
||||
import org.springframework.web.servlet.view.ViewResolverComposite;
|
||||
import org.springframework.web.util.UrlPathHelper;
|
||||
|
||||
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
|
||||
import static com.fasterxml.jackson.databind.MapperFeature.DEFAULT_VIEW_INCLUSION;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static com.fasterxml.jackson.databind.DeserializationFeature.*;
|
||||
import static com.fasterxml.jackson.databind.MapperFeature.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link WebMvcConfigurationSupport} (imported via
|
||||
@@ -123,14 +118,17 @@ public class WebMvcConfigurationSupportTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyViewControllerHandlerMapping() {
|
||||
public void emptyHandlerMappings() {
|
||||
ApplicationContext context = initContext(WebConfig.class);
|
||||
String name = "viewControllerHandlerMapping";
|
||||
AbstractHandlerMapping handlerMapping = context.getBean(name, AbstractHandlerMapping.class);
|
||||
|
||||
assertNotNull(handlerMapping);
|
||||
assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());
|
||||
assertTrue(handlerMapping.getClass().getName().endsWith("EmptyHandlerMapping"));
|
||||
Object nullBean = context.getBean("viewControllerHandlerMapping");
|
||||
assertTrue(nullBean.equals(null));
|
||||
|
||||
nullBean = context.getBean("resourceHandlerMapping");
|
||||
assertTrue(nullBean.equals(null));
|
||||
|
||||
nullBean = context.getBean("defaultServletHandlerMapping");
|
||||
assertTrue(nullBean.equals(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -149,27 +147,6 @@ public class WebMvcConfigurationSupportTests {
|
||||
assertEquals(ResourceUrlProviderExposingInterceptor.class, chain.getInterceptors()[2].getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyResourceHandlerMapping() {
|
||||
ApplicationContext context = initContext(WebConfig.class);
|
||||
AbstractHandlerMapping handlerMapping = context.getBean("resourceHandlerMapping", AbstractHandlerMapping.class);
|
||||
|
||||
assertNotNull(handlerMapping);
|
||||
assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());
|
||||
assertTrue(handlerMapping.getClass().getName().endsWith("EmptyHandlerMapping"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyDefaultServletHandlerMapping() {
|
||||
ApplicationContext context = initContext(WebConfig.class);
|
||||
String name = "defaultServletHandlerMapping";
|
||||
AbstractHandlerMapping handlerMapping = context.getBean(name, AbstractHandlerMapping.class);
|
||||
|
||||
assertNotNull(handlerMapping);
|
||||
assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());
|
||||
assertTrue(handlerMapping.getClass().getName().endsWith("EmptyHandlerMapping"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestMappingHandlerAdapter() throws Exception {
|
||||
ApplicationContext context = initContext(WebConfig.class);
|
||||
|
||||
Reference in New Issue
Block a user