Exemplo n.º 1
0
  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());
  }
Exemplo n.º 2
0
  @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());
  }
Exemplo n.º 3
0
  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"));
  }
Exemplo n.º 4
0
  @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"));
  }