예제 #1
0
  @Test
  public void createQueryStringNoParams() throws JspException {
    List<Param> params = new LinkedList<Param>();
    Set<String> usedParams = new HashSet<String>();

    String queryString = tag.createQueryString(params, usedParams, true);

    assertEquals("", queryString);
  }
예제 #2
0
  @Test
  public void createQueryStringParamEmptyName() throws JspException {
    List<Param> params = new LinkedList<Param>();
    Set<String> usedParams = new HashSet<String>();

    Param param = new Param();
    param.setName("");
    param.setValue("value");
    params.add(param);

    String queryString = tag.createQueryString(params, usedParams, true);

    assertEquals("", queryString);
  }
예제 #3
0
  @Test
  public void createQueryStringOneParamForExsistingQueryString() throws JspException {
    List<Param> params = new LinkedList<Param>();
    Set<String> usedParams = new HashSet<String>();

    Param param = new Param();
    param.setName("name");
    param.setValue("value");
    params.add(param);

    String queryString = tag.createQueryString(params, usedParams, false);

    assertEquals("&name=value", queryString);
  }
예제 #4
0
  @Test
  public void createQueryStringUrlEncoding() throws JspException {
    List<Param> params = new LinkedList<Param>();
    Set<String> usedParams = new HashSet<String>();

    Param param = new Param();
    param.setName("n me");
    param.setValue("v&l=e");
    params.add(param);

    param = new Param();
    param.setName("name");
    param.setValue("value2");
    params.add(param);

    String queryString = tag.createQueryString(params, usedParams, true);

    assertEquals("?n%20me=v%26l%3De&name=value2", queryString);
  }