Methods Summary |
---|
protected void | setUp()
super.setUp();
ActionContext.getContext().setValueStack(stack);
request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);
|
public void | testDefaultValue()
PropertyTag tag = new PropertyTag();
Foo foo = new Foo();
stack.push(foo);
MockJspWriter jspWriter = new MockJspWriter();
jspWriter.setExpectedData("TEST");
MockPageContext pageContext = new MockPageContext();
pageContext.setJspWriter(jspWriter);
pageContext.setRequest(request);
tag.setPageContext(pageContext);
tag.setValue("title");
tag.setDefault("TEST");
try {
tag.doStartTag();
} catch (JspException e) {
e.printStackTrace();
fail();
}
request.verify();
jspWriter.verify();
pageContext.verify();
|
public void | testNull()
PropertyTag tag = new PropertyTag();
Foo foo = new Foo();
stack.push(foo);
MockJspWriter jspWriter = new MockJspWriter();
jspWriter.setExpectedData("");
MockPageContext pageContext = new MockPageContext();
pageContext.setJspWriter(jspWriter);
pageContext.setRequest(request);
tag.setPageContext(pageContext);
tag.setValue("title");
try {
tag.doStartTag();
} catch (JspException e) {
e.printStackTrace();
fail();
}
request.verify();
jspWriter.verify();
pageContext.verify();
|
public void | testSimple()
PropertyTag tag = new PropertyTag();
Foo foo = new Foo();
foo.setTitle("test");
stack.push(foo);
MockJspWriter jspWriter = new MockJspWriter();
jspWriter.setExpectedData("test");
MockPageContext pageContext = new MockPageContext();
pageContext.setJspWriter(jspWriter);
pageContext.setRequest(request);
tag.setPageContext(pageContext);
tag.setValue("title");
try {
tag.doStartTag();
} catch (JspException e) {
e.printStackTrace();
fail();
}
request.verify();
jspWriter.verify();
pageContext.verify();
|
public void | testTopOfStack()
PropertyTag tag = new PropertyTag();
Foo foo = new Foo();
foo.setTitle("test");
stack.push(foo);
MockJspWriter jspWriter = new MockJspWriter();
jspWriter.setExpectedData("Foo is: test");
MockPageContext pageContext = new MockPageContext();
pageContext.setJspWriter(jspWriter);
pageContext.setRequest(request);
tag.setPageContext(pageContext);
try {
tag.doStartTag();
} catch (JspException e) {
e.printStackTrace();
fail();
}
request.verify();
jspWriter.verify();
pageContext.verify();
|
public void | testWithAltSyntax1()
// setups
initDispatcher(new HashMap() {{ put(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "true");}});
Foo foo = new Foo();
foo.setTitle("tm_jee");
stack.push(foo);
MockJspWriter jspWriter = new MockJspWriter();
jspWriter.setExpectedData("Foo is: tm_jee");
MockPageContext pageContext = new MockPageContext();
pageContext.setJspWriter(jspWriter);
pageContext.setRequest(request);
// test
{PropertyTag tag = new PropertyTag();
tag.setPageContext(pageContext);
tag.setValue("%{toString()}");
tag.doStartTag();
tag.doEndTag();}
// verify test
request.verify();
jspWriter.verify();
pageContext.verify();
|
public void | testWithAltSyntax2()
// setups
initDispatcher(new HashMap() {{ put(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "true");}});
Foo foo = new Foo();
foo.setTitle("tm_jee");
stack.push(foo);
MockJspWriter jspWriter = new MockJspWriter();
jspWriter.setExpectedData("Foo is: tm_jee");
MockPageContext pageContext = new MockPageContext();
pageContext.setJspWriter(jspWriter);
pageContext.setRequest(request);
// test
{PropertyTag tag = new PropertyTag();
tag.setPageContext(pageContext);
tag.setValue("toString()");
tag.doStartTag();
tag.doEndTag();}
// verify test
request.verify();
jspWriter.verify();
pageContext.verify();
|
public void | testWithoutAltSyntax1()
// setups
initDispatcher(new HashMap() {{ put(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "false");}});
Foo foo = new Foo();
foo.setTitle("tm_jee");
stack.push(foo);
MockJspWriter jspWriter = new MockJspWriter();
jspWriter.setExpectedData("Foo is: tm_jee");
MockPageContext pageContext = new MockPageContext();
pageContext.setJspWriter(jspWriter);
pageContext.setRequest(request);
// test
{PropertyTag tag = new PropertyTag();
tag.setPageContext(pageContext);
tag.setValue("toString()");
tag.doStartTag();
tag.doEndTag();}
// verify test
request.verify();
jspWriter.verify();
pageContext.verify();
|
public void | testWithoutAltSyntax2()
// setups
initDispatcher(new HashMap() {{ put(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "false");}});
Foo foo = new Foo();
foo.setTitle("tm_jee");
stack.push(foo);
MockJspWriter jspWriter = new MockJspWriter();
MockPageContext pageContext = new MockPageContext();
pageContext.setJspWriter(jspWriter);
pageContext.setRequest(request);
// test
{PropertyTag tag = new PropertyTag();
tag.setPageContext(pageContext);
tag.setValue("%{toString()}");
tag.doStartTag();
tag.doEndTag();}
// verify test
request.verify();
jspWriter.verify();
pageContext.verify();
|