Package org.easymock.internal

Examples of org.easymock.internal.MocksControl


  }

  @Test
  public void testMockDateWithEasyMock() throws Exception {
    Date someDate = new Date();
    MocksControl c = (MocksControl) org.easymock.EasyMock.createControl();
    Date date = c.createMock(Date.class);
    EasyMock.expect(date.after(someDate)).andReturn(false);

    PowerMock.replay(date);

    date.after(someDate);
View Full Code Here


  }

  @Test(expected = IllegalStateException.class)
  public void testMockDateWithEasyMockFails() {
    Date someDate = new Date();
    MocksControl c = (MocksControl) org.easymock.EasyMock.createControl();
    Date date = c.createMock(Date.class, new Method[0]);
    EasyMock.expect(date.after(someDate)).andReturn(false);
    Assert.fail("EasyMock with no methods mocked should not be possible to mock");
  }
View Full Code Here

    public Object invoke(Object proxy, Method method, Object[] arguments) throws Throwable {
        return invocationHandler.invoke(mockInstance == null ? proxy : mockInstance, method, arguments);
    }

    public MocksControl.MockType getMockType() {
        final MocksControl control = invocationHandler.getControl();
        if (WhiteboxImpl.getFieldsOfType(control, MocksControl.MockType.class).isEmpty()) {
            // EasyMock is of version 3.2+
            final MockType mockType = WhiteboxImpl.getInternalState(control, MockType.class);
            switch (mockType) {
                case DEFAULT:
View Full Code Here

    }
    this.mockType = mockType;
  }

  public IMocksControl createMockControl(Class<?> type) {
    return new MocksControl(mockType);
  }
View Full Code Here

TOP

Related Classes of org.easymock.internal.MocksControl

Copyright © 2018 www.massapicom. 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.