Remove @MVC test with multiple matches

RequestMappingHandlerMapping currently picks the first match and does
have logic to deal with selecting the best match. This caused a
random test failure depending on which controller method was matched
first. This change removes the test.
This commit is contained in:
Rossen Stoyanchev 2015-11-20 13:17:10 -05:00
parent e9e4bcdc59
commit 8d30722f21
1 changed files with 7 additions and 11 deletions

View File

@ -32,7 +32,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.context.support.StaticWebApplicationContext;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.reactive.method.annotation.RequestMappingHandlerMapping;
import static org.junit.Assert.assertEquals;
@ -43,6 +42,7 @@ public class RequestMappingHandlerMappingTests {
private RequestMappingHandlerMapping mapping;
@Before
public void setup() {
StaticWebApplicationContext wac = new StaticWebApplicationContext();
@ -52,6 +52,7 @@ public class RequestMappingHandlerMappingTests {
this.mapping = (RequestMappingHandlerMapping)wac.getBean("handlerMapping");
}
@Test
public void path() throws Exception {
ReactiveServerHttpRequest request = new MockServerHttpRequest(HttpMethod.GET, "boo");
@ -68,10 +69,6 @@ public class RequestMappingHandlerMappingTests {
request = new MockServerHttpRequest(HttpMethod.GET, "foo");
handler = (HandlerMethod) this.mapping.getHandler(request);
assertEquals(TestController.class.getMethod("getFoo"), handler.getMethod());
request = new MockServerHttpRequest(HttpMethod.PUT, "foo");
handler = (HandlerMethod) this.mapping.getHandler(request);
assertEquals(TestController.class.getMethod("foo"), handler.getMethod());
}
@ -79,11 +76,6 @@ public class RequestMappingHandlerMappingTests {
@SuppressWarnings("unused")
private static class TestController {
@RequestMapping("foo")
public String foo() {
return "foo";
}
@RequestMapping(path = "foo", method = RequestMethod.POST)
public String postFoo() {
return "postFoo";
@ -106,7 +98,11 @@ public class RequestMappingHandlerMappingTests {
}
private static class MockServerHttpRequest implements ReactiveServerHttpRequest{
/**
* TODO: this is more widely needed.
*/
private static class MockServerHttpRequest implements ReactiveServerHttpRequest {
private HttpMethod method;