public void testReplaceUriTemplateParamsTemplateWithoutParamMatch() throws JspException { List<Param> params = new LinkedList<Param>(); Set<String> usedParams = new HashSet<String>(); String uri = tag.replaceUriTemplateParams("url/{path}", params, usedParams); assertEquals("url/{path}", uri); assertEquals(0, usedParams.size()); }
@Test public void replaceUriTemplateParamsNoParams() throws JspException { List<Param> params = new LinkedList<Param>(); Set<String> usedParams = new HashSet<String>(); String uri = tag.replaceUriTemplateParams("url/path", params, usedParams); assertEquals("url/path", uri); assertEquals(0, usedParams.size()); }
public void testReplaceUriTemplateParamsTemplateWithParamMatchValueEncoded() throws JspException { List<Param> params = new LinkedList<Param>(); Set<String> usedParams = new HashSet<String>(); Param param = new Param(); param.setName("name"); param.setValue("v lue"); params.add(param); String uri = tag.replaceUriTemplateParams("url/{name}", params, usedParams); assertEquals("url/v%20lue", uri); assertEquals(1, usedParams.size()); assertTrue(usedParams.contains("name")); }
@Test public void replaceUriTemplateParamsTemplateWithPathSegment() throws JspException { List<Param> params = new LinkedList<Param>(); Set<String> usedParams = new HashSet<String>(); Param param = new Param(); param.setName("name"); param.setValue("my/Id"); params.add(param); String uri = tag.replaceUriTemplateParams("url/{/name}", params, usedParams); assertEquals("url/my%2FId", uri); assertEquals(1, usedParams.size()); assertTrue(usedParams.contains("name")); }