From: Jeff M. <cus...@us...> - 2003-05-01 09:19:32
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com/mockobjects/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv22959/src/j2ee/1.3/com/mockobjects/servlet Modified Files: MockHttpSession.java Log Message: Added setupGetAttribute instead of setAttribute Index: MockHttpSession.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com/mockobjects/servlet/MockHttpSession.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- MockHttpSession.java 24 Mar 2003 11:10:20 -0000 1.4 +++ MockHttpSession.java 1 May 2003 09:19:25 -0000 1.5 @@ -1,26 +1,22 @@ package com.mockobjects.servlet; -import com.mockobjects.ExpectationSet; -import com.mockobjects.MapEntry; -import com.mockobjects.MockObject; -import com.mockobjects.Verifiable; +import com.mockobjects.*; import javax.servlet.ServletContext; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionContext; import java.util.Enumeration; -import java.util.HashMap; public class MockHttpSession extends MockObject implements HttpSession, Verifiable { private ExpectationSet myAttributes = new ExpectationSet("session attributes"); private ExpectationSet myRemovedAttributes = new ExpectationSet("removed session attributes"); - private HashMap myAttributeValues = new HashMap(); + private ReturnObjectBag myAttributeValues = new ReturnObjectBag("attributes"); private Enumeration attributeNames; private ServletContext servletContext; public Object getAttribute(String anAttributeName) { - return myAttributeValues.get(anAttributeName); + return myAttributeValues.getNextReturnObject(anAttributeName); } public void setupGetAttributeNames(Enumeration attributeNames) { @@ -93,15 +89,17 @@ public void removeAttribute(String anAttributeName) { myRemovedAttributes.addActual(anAttributeName); - myAttributeValues.remove(anAttributeName); } public void removeValue(String arg1) { notImplemented(); } + public void setupGetAttribute(String key, Object value){ + myAttributeValues.putObjectToReturn(key, value); + } + public void setAttribute(String aKey, Object aValue) { - myAttributeValues.put(aKey, aValue); myAttributes.addActual(new MapEntry(aKey, aValue)); } |