@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)); }
@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)); }
@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")); }