SPR-5251: URI Templates support infix variables: A-{B}-C

This commit is contained in:
Arjen Poutsma
2008-11-19 11:48:13 +00:00
parent 90ef7649c2
commit bb5150361b
2 changed files with 47 additions and 19 deletions

View File

@@ -295,7 +295,11 @@ public class AntPathMatcherTests {
@Test
public void extractUriTemplateVariables() throws Exception {
Map<String,String> result = pathMatcher.extractUriTemplateVariables("/hotels/{hotel}", "/hotels/1");
Map<String,String> result;
result = pathMatcher.extractUriTemplateVariables("/hotels/{hotel}", "/hotels/1");
assertEquals(Collections.singletonMap("hotel", "1"), result);
result = pathMatcher.extractUriTemplateVariables("/h?tels/{hotel}", "/hotels/1");
assertEquals(Collections.singletonMap("hotel", "1"), result);
result = pathMatcher.extractUriTemplateVariables("/hotels/{hotel}/bookings/{booking}", "/hotels/1/bookings/2");
@@ -306,6 +310,12 @@ public class AntPathMatcherTests {
result = pathMatcher.extractUriTemplateVariables("/**/hotels/**/{hotel}", "/foo/hotels/bar/1");
assertEquals(Collections.singletonMap("hotel", "1"), result);
result = pathMatcher.extractUriTemplateVariables("/{page}.html", "/42.html");
assertEquals(Collections.singletonMap("page", "42"), result);
result = pathMatcher.extractUriTemplateVariables("/A-{B}-C", "/A-b-C");
assertEquals(Collections.singletonMap("B", "b"), result);
}