Basic Unit test for a WW Action?
Ghetto Java <[email protected]>
| Newsgroups | gmane.comp.java.open-symphony.webwork |
|---|---|
| Message-ID | <21307145.1150146633522.JavaMail.os-j2ee@opensymphony01.managed.contegix.com> |
Hello,
Trying to follow WW in Action I can up with the following unit test method and
the subsequent exception, I've been searching the forum for example but not having much luck.
Thanks
Vinny
//
public void testHomeAction() throws Exception {
HomeAction homeAction = new HomeAction(); // implements ServletRequestAware
MockHttpServletRequest mockReq = new MockHttpServletRequest();
mockReq.setupAddParameter("name","Vincent");
homeAction.setServletRequest(mockReq);
homeAction.execute();
String attributeValue = (String) mockReq.getAttribute("name") ; //line 44
assertEquals(attributeValue,"Vincent");
}
///
Test set: com.aaxistechnologies.FirstActionTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.069 sec <<< FAILURE!
testHomeAction(com.aaxistechnologies.FirstActionTest) Time elapsed: 0.058 sec <<< FAILURE!
junit.framework.AssertionFailedError: attributes has run out of objects.
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at com.mockobjects.ReturnObjectList.nextReturnObject(ReturnObjectList.java:61)
at com.mockobjects.servlet.MockHttpServletRequest.getAttribute(MockHttpServletRequest.java:62)
at com.aaxistechnologies.FirstActionTest.testHomeAction(FirstActionTest.java:44)
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=34109&messageID=66312#66312
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]