webwork/src/test/webwork/action/factory SessionMapTestCase.java,1.1,1.2
[email protected] Sun, 28 Dec 2003 16:58:02 -0800
| Newsgroups | gmane.comp.java.open-symphony.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/opensymphony/webwork/src/test/webwork/action/factory
In directory sc8-pr-cvs1:/tmp/cvs-serv10919/src/test/webwork/action/factory
Modified Files:
SessionMapTestCase.java
Log Message:
Fixed test. Mock tests really are stupid.
Index: SessionMapTestCase.java
===================================================================
RCS file: /cvsroot/opensymphony/webwork/src/test/webwork/action/factory/SessionMapTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- SessionMapTestCase.java 29 Dec 2003 00:25:32 -0000 1.1
+++ SessionMapTestCase.java 29 Dec 2003 00:58:00 -0000 1.2
@@ -56,6 +56,7 @@
public void testPuttingObjectInMapReturnsNullForPreviouslyUnusedKey() throws Exception {
Mock sessionMock = new Mock(HttpSession.class);
Object value = new Object();
+ sessionMock.expectAndReturn("getAttribute", new Constraint[]{new IsEqual("KEY")}, null);
sessionMock.expect("setAttribute", new Constraint[]{new IsEqual("KEY"),new IsEqual(value)});
MockSessionMap sessionMap = new MockSessionMap((HttpSession) sessionMock.proxy());
assertNull("should be null, as the contract for Map says that put returns the previous value in the map for the key",sessionMap.put("KEY", value));
@@ -66,7 +67,9 @@
Mock sessionMock = new Mock(HttpSession.class);
Object originalValue = new Object();
Object value = new Object();
+ sessionMock.expectAndReturn("getAttribute", new Constraint[]{new IsEqual("KEY")}, null);
sessionMock.expect("setAttribute", new Constraint[]{new IsEqual("KEY"),new IsEqual(originalValue)});
+ sessionMock.expectAndReturn("getAttribute", new Constraint[]{new IsEqual("KEY")}, originalValue);
sessionMock.expect("setAttribute", new Constraint[]{new IsEqual("KEY"),new IsEqual(value)});
MockSessionMap sessionMap = new MockSessionMap((HttpSession) sessionMock.proxy());
sessionMap.put("KEY", originalValue);
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click