diff options
author | Torbjørn Smørgrav <smorgrav@users.noreply.github.com> | 2019-03-20 09:58:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-20 09:58:34 +0100 |
commit | 7ed1d00ff9e1b723f7fa71e323bf579a442abf25 (patch) | |
tree | c3ad289307510d52c307072aa3e07a136790d9a9 /container-core/src/test | |
parent | e75e2d3987f57103e5f5d50cccdf0af46ae7d2e4 (diff) | |
parent | cf6e756cdf0ce088167f7618294753313665efee (diff) |
Merge pull request #8806 from vespa-engine/smorgrav/path_with_prefix
Add support for an optional prefix to path matching
Diffstat (limited to 'container-core/src/test')
-rw-r--r-- | container-core/src/test/java/com/yahoo/restapi/PathTest.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/container-core/src/test/java/com/yahoo/restapi/PathTest.java b/container-core/src/test/java/com/yahoo/restapi/PathTest.java index 9e77dc7b3f0..886b3ba9c87 100644 --- a/container-core/src/test/java/com/yahoo/restapi/PathTest.java +++ b/container-core/src/test/java/com/yahoo/restapi/PathTest.java @@ -11,7 +11,20 @@ import static org.junit.Assert.assertEquals; * @author bratseth */ public class PathTest { - + + @Test + public void testWithPrefix() { + // Test that a path with a prefix matches spec without the prefix + Path path = new Path("/ball/a/1/bar/fuz", "/ball"); + assertTrue(path.matches("/a/{foo}/bar/{b}")); + assertEquals("1", path.get("foo")); + assertEquals("fuz", path.get("b")); + + // Also test that prefix does not cause false matches + assertFalse(path.matches("/ball/a/{foo}/zoo/{b}")); + } + + @Test public void testPath() { assertFalse(new Path("").matches("/a/{foo}/bar/{b}")); |