diff options
Diffstat (limited to 'container-core/src/test/java/com/yahoo/restapi/PathTest.java')
-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}")); |