Consistent HttpMethod resolution against underlying HttpServletRequest

This commit is contained in:
Juergen Hoeller
2015-09-24 20:53:22 +02:00
parent 90409cbe98
commit 11b4e3be2c
5 changed files with 14 additions and 16 deletions

View File

@@ -96,7 +96,7 @@ public class RequestMappingHandlerAdapterTests {
this.webAppContext = new StaticWebApplicationContext();
this.handlerAdapter = new RequestMappingHandlerAdapter();
this.handlerAdapter.setApplicationContext(this.webAppContext);
this.request = new MockHttpServletRequest();
this.request = new MockHttpServletRequest("GET", "/");
this.response = new MockHttpServletResponse();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,16 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.servlet.mvc.method.annotation;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.beans.ConversionNotSupportedException;
import org.springframework.beans.TypeMismatchException;
@@ -56,7 +57,6 @@ import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMeth
import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver;
import static org.junit.Assert.*;
import org.mockito.Mockito;
/**
* Test fixture for {@link ResponseEntityExceptionHandler}.
@@ -71,14 +71,14 @@ public class ResponseEntityExceptionHandlerTests {
private WebRequest request;
private HttpServletRequest servletRequest;
private MockHttpServletRequest servletRequest;
private MockHttpServletResponse servletResponse;
@Before
public void setup() {
this.servletRequest = new MockHttpServletRequest();
this.servletRequest = new MockHttpServletRequest("GET", "/");
this.servletResponse = new MockHttpServletResponse();
this.request = new ServletWebRequest(this.servletRequest, this.servletResponse);

View File

@@ -22,7 +22,6 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.junit.Test;
@@ -66,7 +65,7 @@ public class ServletInvocableHandlerMethodTests {
private final ModelAndViewContainer mavContainer = new ModelAndViewContainer();
private final MockHttpServletRequest request = new MockHttpServletRequest();
private final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/");
private final MockHttpServletResponse response = new MockHttpServletResponse();