Remove warning about empty @RequestMapping path

See gh-22543
This commit is contained in:
Rossen Stoyanchev
2019-04-09 13:12:35 -04:00
parent 5b17bb2e14
commit f839c1f9cd
8 changed files with 15 additions and 66 deletions

View File

@@ -78,7 +78,7 @@ public class RequestMappingInfoHandlerMappingTests {
private HandlerMethod barMethod;
private HandlerMethod rootMethod;
private HandlerMethod emptyMethod;
@Before
@@ -88,7 +88,7 @@ public class RequestMappingInfoHandlerMappingTests {
this.fooMethod = new HandlerMethod(testController, "foo");
this.fooParamMethod = new HandlerMethod(testController, "fooParam");
this.barMethod = new HandlerMethod(testController, "bar");
this.rootMethod = new HandlerMethod(testController, "root");
this.emptyMethod = new HandlerMethod(testController, "empty");
this.handlerMapping = new TestRequestMappingInfoHandlerMapping();
this.handlerMapping.registerHandler(testController);
@@ -125,12 +125,12 @@ public class RequestMappingInfoHandlerMappingTests {
MockHttpServletRequest request = new MockHttpServletRequest("GET", "");
HandlerMethod handlerMethod = getHandler(request);
assertEquals(this.rootMethod.getMethod(), handlerMethod.getMethod());
assertEquals(this.emptyMethod.getMethod(), handlerMethod.getMethod());
request = new MockHttpServletRequest("GET", "/");
handlerMethod = getHandler(request);
assertEquals(this.rootMethod.getMethod(), handlerMethod.getMethod());
assertEquals(this.emptyMethod.getMethod(), handlerMethod.getMethod());
}
@Test
@@ -465,8 +465,8 @@ public class RequestMappingInfoHandlerMappingTests {
public void bar() {
}
@RequestMapping("/")
public void root() {
@RequestMapping("")
public void empty() {
}
@RequestMapping(value = "/person/{id}", method = RequestMethod.PUT, consumes="application/xml")

View File

@@ -228,7 +228,7 @@ public class RequestMappingHandlerMappingTests {
@RequestMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
static class ComposedAnnotationController {
@RequestMapping("/**")
@RequestMapping
public void handle() {
}

View File

@@ -2016,7 +2016,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@Controller
static class ControllerWithEmptyValueMapping {
@RequestMapping("/**")
@RequestMapping("")
public void myPath2(HttpServletResponse response) throws IOException {
throw new IllegalStateException("test");
}
@@ -2035,7 +2035,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@Controller
private static class ControllerWithErrorThrown {
@RequestMapping("/**")
@RequestMapping("")
public void myPath2(HttpServletResponse response) throws IOException {
throw new AssertionError("test");
}
@@ -3629,7 +3629,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@Controller
static class HttpHeadersResponseController {
@RequestMapping(value = "/*", method = RequestMethod.POST)
@RequestMapping(value = "", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
public HttpHeaders create() throws URISyntaxException {
HttpHeaders headers = new HttpHeaders();