use of com.mockobjects.constraint.IsEqual in project struts by apache.
the class SessionMapTest method testPutObjectOnSessionMapUsesWrappedSessionsSetsAttributeWithStringValue.
public void testPutObjectOnSessionMapUsesWrappedSessionsSetsAttributeWithStringValue() throws Exception {
Object key = new Object();
Object value = new Object();
sessionMock.expect("getAttribute", new Constraint[] { new IsAnything() });
sessionMock.expect("setAttribute", new Constraint[] { new IsEqual(key.toString()), new IsEqual(value) });
SessionMap sessionMap = new SessionMap((HttpServletRequest) requestMock.proxy());
sessionMap.put(key, value);
sessionMock.verify();
}
use of com.mockobjects.constraint.IsEqual in project struts by apache.
the class SessionMapTest method testGetObjectOnSessionMapUsesWrappedSessionsGetAttributeWithStringValue.
public void testGetObjectOnSessionMapUsesWrappedSessionsGetAttributeWithStringValue() throws Exception {
Object key = new Object();
Object value = new Object();
sessionMock.expectAndReturn("getAttribute", new Constraint[] { new IsEqual(key.toString()) }, value);
SessionMap sessionMap = new SessionMap((HttpServletRequest) requestMock.proxy());
assertEquals("Expected the get using KEY to return the value object setup in the mockSession", value, sessionMap.get(key));
sessionMock.verify();
}
use of com.mockobjects.constraint.IsEqual in project struts by apache.
the class SessionMapTest method testPutOnSessionMapUsesWrappedSessionsSetsAttribute.
public void testPutOnSessionMapUsesWrappedSessionsSetsAttribute() throws Exception {
Object value = new Object();
sessionMock.expect("getAttribute", new Constraint[] { new IsAnything() });
sessionMock.expect("setAttribute", new Constraint[] { new IsEqual("KEY"), new IsEqual(value) });
SessionMap sessionMap = new SessionMap((HttpServletRequest) requestMock.proxy());
sessionMap.put("KEY", value);
sessionMock.verify();
}
use of com.mockobjects.constraint.IsEqual in project struts by apache.
the class SessionMapTest method testGetOnSessionMapUsesWrappedSessionsGetAttribute.
public void testGetOnSessionMapUsesWrappedSessionsGetAttribute() throws Exception {
Object value = new Object();
sessionMock.expectAndReturn("getAttribute", new Constraint[] { new IsEqual("KEY") }, value);
SessionMap sessionMap = new SessionMap((HttpServletRequest) requestMock.proxy());
assertEquals("Expected the get using KEY to return the value object setup in the mockSession", value, sessionMap.get("KEY"));
sessionMock.verify();
}
Aggregations