SPR-5812 - Custom regex matching for @PathVariable

This commit is contained in:
Arjen Poutsma
2009-06-12 12:58:27 +00:00
parent 0096930a72
commit ed98bf0668
2 changed files with 34 additions and 7 deletions

View File

@@ -334,6 +334,20 @@ public class AntPathMatcherTests {
assertEquals(expected, result);
}
@Test
public void extractUriTemplateVariablesCustomRegex() {
Map<String, String> result = pathMatcher
.extractUriTemplateVariables("{symbolicName:[\\w\\.]+}-{version:[\\w\\.]+}.jar",
"com.example-1.0.0.jar");
assertEquals("com.example", result.get("symbolicName"));
assertEquals("1.0.0", result.get("version"));
result = pathMatcher.extractUriTemplateVariables("{symbolicName:[\\w\\.]+}-sources-{version:[\\w\\.]+}.jar",
"com.example-sources-1.0.0.jar");
assertEquals("com.example", result.get("symbolicName"));
assertEquals("1.0.0", result.get("version"));
}
@Test
public void combine() {
assertEquals("", pathMatcher.combine(null, null));