Examples of IsEqual


Examples of com.mockobjects.constraint.IsEqual

    }

    public void testPuttingObjectInMapReturnsNullForPreviouslyUnusedKey() throws Exception {
        Object value = new Object();
        sessionMock.expectAndReturn("getAttribute", new Constraint[]{
                new IsEqual("KEY")
        }, null);
        sessionMock.expect("setAttribute", new Constraint[]{
                new IsEqual("KEY"), new IsEqual(value)
        });

        SessionMap sessionMap = new SessionMap((HttpServletRequest) requestMock.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));
        sessionMock.verify();
View Full Code Here

Examples of com.mockobjects.constraint.IsEqual

    public void testPuttingObjectInMapReturnsPreviousValueForKey() throws Exception {
        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)
        });

        SessionMap sessionMap = new SessionMap((HttpServletRequest) requestMock.proxy());
        sessionMap.put("KEY", originalValue);
        assertEquals("should be the OriginalValue, as the contract for Map says that put returns the previous value in the map for the key", originalValue, sessionMap.put("KEY", value));
View Full Code Here

Examples of com.mockobjects.constraint.IsEqual

    }

    public void testRemovePassThroughCallToRemoveAttribute() throws Exception {
        Object value = new Object();
        sessionMock.expectAndReturn("getAttribute", new Constraint[]{
                new IsEqual("KEY")
        }, value);
        sessionMock.expect("removeAttribute", new Constraint[]{
                new IsEqual("KEY")
        });

        SessionMap sessionMap = new SessionMap((HttpServletRequest) requestMock.proxy());
        assertEquals(value, sessionMap.remove("KEY"));
        sessionMock.verify();
View Full Code Here

Examples of com.mockobjects.constraint.IsEqual

    }

    protected void setUp() throws Exception {
        sessionMock = new Mock(HttpSession.class);
        requestMock = new Mock(HttpServletRequest.class);
        requestMock.matchAndReturn("getSession", new Constraint[]{new IsEqual(Boolean.FALSE)}, sessionMock.proxy());
    }
View Full Code Here

Examples of org.hamcrest.core.IsEqual

  public boolean matches(Object obj) {
    if (!(obj instanceof Collection)) {
      return false;
    }

    return new IsEqual(((Collection) sourceCollection).toArray()).matches(((Collection) obj).toArray());
  }
View Full Code Here

Examples of org.jmock.constraint.IsEqual

    public MethodNameMatcher(Constraint constraint) {
        this.constraint = constraint;
    }

    public MethodNameMatcher(String methodName) {
        this(new IsEqual(methodName));
    }
View Full Code Here

Examples of org.jmock.core.constraint.IsEqual

*/
public class CreateSessionInterceptorTest extends StrutsInternalTestCase {

    public void testCreateSession() throws Exception {
        Mock httpServletRequestMock = new Mock(HttpServletRequest.class);
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.FALSE));
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.TRUE));
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.FALSE));
        HttpServletRequest request = (HttpServletRequest) httpServletRequestMock.proxy();

        ServletActionContext.setRequest(request);

        CreateSessionInterceptor interceptor = new CreateSessionInterceptor();
View Full Code Here

Examples of org.jmock.core.constraint.IsEqual

    protected Stub onConsecutiveCalls( Stub stub1, Stub stub2, Stub stub3, Stub stub4 ) {
        return new StubSequence(new Stub[]{stub1, stub2, stub3, stub4});
    }

    protected IsEqual eq( Object operand ) {
        return new IsEqual(operand);
    }
View Full Code Here

Examples of org.jmock.core.constraint.IsEqual

*/
public class CreateSessionInterceptorTest extends StrutsTestCase {

  public void testCreateSession() throws Exception {
    Mock httpServletRequestMock = new Mock(HttpServletRequest.class);
    httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.TRUE));
    HttpServletRequest request = (HttpServletRequest) httpServletRequestMock.proxy();

    ServletActionContext.setRequest(request);

    CreateSessionInterceptor interceptor = new CreateSessionInterceptor();
View Full Code Here

Examples of org.jmock.core.constraint.IsEqual

        portletSizesParamMock = new Mock(Parameter.class);
        portletSizesParam = (Parameter) portletSizesParamMock.proxy();

        expectAndReturn(new InvokeAtLeastOnceMatcher(), portletSizesParamMock, "getValue", "33%,66%");
        expectAndReturn(new InvokeAtLeastOnceMatcher(), portletDefInitParamsMock, "get",new Constraint[] {new IsEqual("sizes")}, portletSizesParam);
        expectAndReturn(new InvokeAtLeastOnceMatcher(), portletDefMock, "getInitParameterSet", portletDefInitParams);
        expectAndReturn(new InvokeAtLeastOnceMatcher(), portletRegistryMock, "getPortletDefinitionByUniqueName",new Constraint[] {new IsEqual("layout")}, portletDef);
        return portletRegistry;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.