FreemarkerTestpublic class FreemarkerTest extends TestCase
Fields Summary |
---|
TestAction | testAction |
Constructors Summary |
---|
public FreemarkerTest(String name)
super(name);
|
Methods Summary |
---|
protected void | setUp()
super.setUp();
ValueStack stack = ValueStackFactory.getFactory().createValueStack();
ActionContext.setContext(new ActionContext(stack.getContext()));
testAction = new TestAction();
ActionContext.getContext().getValueStack().push(testAction);
| protected void | tearDown()
super.tearDown();
ActionContext.setContext(null);
| public void | testSelectHelper()
StrutsUtil wwUtil = new StrutsUtil(ActionContext.getContext().getValueStack(), null, null);
List selectList = null;
selectList = wwUtil.makeSelectList("ignored", "stringList", null, null);
assertEquals("one", ((ListEntry) selectList.get(0)).getKey());
assertEquals("one", ((ListEntry) selectList.get(0)).getValue());
selectList = wwUtil.makeSelectList("ignored", "beanList", "name", "value");
assertEquals("one", ((ListEntry) selectList.get(0)).getKey());
assertEquals("1", ((ListEntry) selectList.get(0)).getValue());
| public void | testValueStackMode()
ScopesHashModel model = new ScopesHashModel(ObjectWrapper.BEANS_WRAPPER, null, null, ActionContext.getContext().getValueStack());
CollectionModel stringList = null;
stringList = (CollectionModel) model.get("stringList");
assertEquals("one", stringList.get(0).toString());
assertEquals("one", model.get("stringList[0]").toString());
assertEquals("one", model.get("beanList[0].name").toString());
|
|