Esempio n. 1
0
  @Test
  public void doEndTag() throws JspException {
    tag.setValue("url/path");

    tag.doStartTag();
    int action = tag.doEndTag();

    assertEquals(Tag.EVAL_PAGE, action);
  }
Esempio n. 2
0
  @Test
  public void varDefaultScope() throws JspException {
    tag.setValue("url/path");
    tag.setVar("var");

    tag.doStartTag();
    tag.doEndTag();

    assertEquals("url/path", context.getAttribute("var", PageContext.PAGE_SCOPE));
  }
Esempio n. 3
0
  @Test
  public void varExplicitScope() throws JspException {
    tag.setValue("url/path");
    tag.setVar("var");
    tag.setScope("request");

    tag.doStartTag();
    tag.doEndTag();

    assertEquals("url/path", context.getAttribute("var", PageContext.REQUEST_SCOPE));
  }
Esempio n. 4
0
  @Test
  public void setHtmlEscapeDefault() throws JspException {
    tag.setValue("url/path");
    tag.setVar("var");

    tag.doStartTag();

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

    param = new Param();
    param.setName("name");
    param.setValue("value2");
    tag.addParam(param);

    tag.doEndTag();

    assertEquals("url/path?n%20me=v%26l%3De&name=value2", context.getAttribute("var"));
  }