Polishing contribution
See gh-24143
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 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.
|
||||
@@ -435,15 +435,15 @@ public class MvcUriComponentsBuilderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fromMappingNameWithNonSlashPath() {
|
||||
public void fromMappingNameWithPathWithoutLeadingSlash() {
|
||||
|
||||
initWebApplicationContext(NonSlashPathWebConfig.class);
|
||||
initWebApplicationContext(PathWithoutLeadingSlashConfig.class);
|
||||
|
||||
this.request.setServerName("example.org");
|
||||
this.request.setServerPort(9999);
|
||||
this.request.setContextPath("/base");
|
||||
|
||||
String mappingName = "NSPC#getAddressesForCountry";
|
||||
String mappingName = "PWLSC#getAddressesForCountry";
|
||||
String url = fromMappingName(mappingName).arg(0, "DE;FR").encode().buildAndExpand("_+_");
|
||||
assertThat(url).isEqualTo("/base/people/DE%3BFR");
|
||||
}
|
||||
@@ -512,9 +512,8 @@ public class MvcUriComponentsBuilderTests {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping({"people"})
|
||||
static class NonSlashPathController {
|
||||
static class PathWithoutLeadingSlashController {
|
||||
|
||||
@RequestMapping("/{country}")
|
||||
HttpEntity<Void> getAddressesForCountry(@PathVariable String country) {
|
||||
@@ -646,11 +645,11 @@ public class MvcUriComponentsBuilderTests {
|
||||
|
||||
|
||||
@EnableWebMvc
|
||||
static class NonSlashPathWebConfig implements WebMvcConfigurer {
|
||||
static class PathWithoutLeadingSlashConfig implements WebMvcConfigurer {
|
||||
|
||||
@Bean
|
||||
public NonSlashPathController controller() {
|
||||
return new NonSlashPathController();
|
||||
public PathWithoutLeadingSlashController controller() {
|
||||
return new PathWithoutLeadingSlashController();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user