Search in sources :

Example 1 with IsAnything

use of com.mockobjects.constraint.IsAnything 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();
}
Also used : IsAnything(com.mockobjects.constraint.IsAnything) IsEqual(com.mockobjects.constraint.IsEqual)

Example 2 with IsAnything

use of com.mockobjects.constraint.IsAnything 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();
}
Also used : IsAnything(com.mockobjects.constraint.IsAnything) IsEqual(com.mockobjects.constraint.IsEqual)

Aggregations

IsAnything (com.mockobjects.constraint.IsAnything)2 IsEqual (com.mockobjects.constraint.IsEqual)2