EasyMock. It contains the state of the mocks.
| Modifier and Type | Field and Description |
|---|---|
| public static final Range | AT_LEAST_ONCE
One or more calls. |
| private IMocksBehavior | |
| private static volatile IProxyFactory | classProxyFactory
lazily created; the proxy factory for classes |
| private static final IProxyFactory | |
| public static final Range | ONCE
Exactly one call. |
| private static final long | |
| private IMocksControlState | |
| private MockType | |
| public static final Range | ZERO_OR_MORE
Zero or more calls. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public IExpectationSetters | andAnswer(IAnswer<?>
the object used to answer the invocation. answer)Implements org. |
| public IExpectationSetters | andDelegateTo(Object
the object the call is delegated to. answer)Implements org. |
| public IExpectationSetters | andReturn(Object
the value to return. value)Implements org. |
| public void | andStubAnswer(IAnswer<?>
the object used to answer the invocation. answer)Implements org. |
| public void | andStubDelegateTo(Object
the object the call is delegated to. delegateTo)Implements org. |
| public void | andStubReturn(Object
the value to return. value)Implements org. |
| public void | andStubThrow(Throwable
the throwable to throw. throwable)Implements org. |
| public IExpectationSetters | andThrow(Throwable
the throwable to throw. throwable)Implements org. |
| public IExpectationSetters | |
| public IExpectationSetters | anyTimes()
Implements org. |
| public void | asStub()
Implements org. |
| public IExpectationSetters | atLeastOnce()
Implements org. |
| private <T> void | |
| public void | checkIsUsedInOneThread(boolean
If it should be used in one thread only or not shouldBeUsedInOneThread)Implements org. |
| public void | checkOrder(boolean
true switches order checking on,
false switches it off.Implements org. |
| public <T, R> R | createMock(Class<T>
the interface or class that the mock object should
implement/extend. toMock)Implements org. mock(Class) but using the old naming.
|
| public <T, R> R | createMock(String
the name of the mock object. name, Class<T> the interface or class that the mock object should
implement/extend. toMock)Implements org. mock(String, Class) but using the old naming.
|
| public <T, R> R | createMock(String
the name of the mock object. name, Class<T> the class that the mock object should extend. toMock, ConstructorArgs constructor and parameters used to instantiate the mock. If null, no constructor will be called constructorArgs, Method... methods that will be mocked, other methods will behave
normally. If empty, all methods will be mocked mockedMethods)Implements org. mock(String, Class, ConstructorArgs, Method. but using the old naming
|
| private static IProxyFactory | |
| public static MocksControl | |
| public static InvocationHandler | |
| public static < Mocked class T, Mock class R extends T> Class | Returns: the mocked class or interfaceMock object proxy)Return the class of interface (depending on the mock type) that was mocked |
| public static IProxyFactory | |
| public IMocksControlState | |
| public MockType | |
| public void | makeThreadSafe(boolean
If the mock should be thread safe or not threadSafe)Implements org. |
| public IExpectationSetters | |
| public void | replay()
Implements org. |
| public void | reset()
Implements org. |
| public void | resetToDefault()
Implements org. |
| public void | resetToNice()
Implements org. |
| public void | resetToStrict()
Implements org. |
| public IExpectationSetters | times(int
the number of invocations expected times)Implements org. count times.
|
| public IExpectationSetters | times(int
the minimum number of invocations expected. min, int the maximum number of invocations expected. max)Implements org. min and max
times.
|
| public void | verify()
Implements org. |
| public void | verifyRecording()
Implements org. |
| public void | verifyUnexpectedCalls()
Implements org. |
| AT_LEAST_ONCE | back to summary |
|---|---|
| public static final Range AT_LEAST_ONCE One or more calls. | |
| behavior | back to summary |
|---|---|
| private IMocksBehavior behavior | |
| classProxyFactory | back to summary |
|---|---|
| private static volatile IProxyFactory classProxyFactory lazily created; the proxy factory for classes | |
| interfaceProxyFactory | back to summary |
|---|---|
| private static final IProxyFactory interfaceProxyFactory | |
| ONCE | back to summary |
|---|---|
| public static final Range ONCE Exactly one call. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| state | back to summary |
|---|---|
| private IMocksControlState state | |
| type | back to summary |
|---|---|
| private MockType type | |
| ZERO_OR_MORE | back to summary |
|---|---|
| public static final Range ZERO_OR_MORE Zero or more calls. | |
| MocksControl | back to summary |
|---|---|
| public MocksControl(MockType type) | |
| andAnswer | back to summary |
|---|---|
| public IExpectationSetters Implements org. Doc from org. Sets an object that will be used to calculate the answer for the expected invocation (either return a value, or throw an exception).
| |
| andDelegateTo | back to summary |
|---|---|
| public IExpectationSetters Implements org. Doc from org. Sets an object implementing the same interface as the mock. The expected method call will be delegated to it with the actual arguments. The answer returned by this call will then be the answer returned by the mock (either return a value, or throw an exception).
| |
| andReturn | back to summary |
|---|---|
| public IExpectationSetters Implements org. Doc from org. Sets a return value that will be returned for the expected invocation.
| |
| andStubAnswer | back to summary |
|---|---|
| public void andStubAnswer(IAnswer<?> answer) Implements org. Doc from org. Sets a stub object that will be used to calculate the answer for the expected invocation (either return a value, or throw an exception). | |
| andStubDelegateTo | back to summary |
|---|---|
| public void andStubDelegateTo(Object delegateTo) Implements org. Doc from org. Sets a stub object implementing the same interface as the mock. The expected method call will be delegated to it with the actual arguments. The answer returned by this call will then be the answer returned by the mock (either return a value, or throw an exception). | |
| andStubReturn | back to summary |
|---|---|
| public void andStubReturn(Object value) Implements org. Doc from org. Sets a stub return value that will be returned for the expected invocation. | |
| andStubThrow | back to summary |
|---|---|
| public void andStubThrow(Throwable throwable) Implements org. Doc from org. Sets a stub throwable that will be thrown for the expected invocation. | |
| andThrow | back to summary |
|---|---|
| public IExpectationSetters Implements org. Doc from org. Sets a throwable that will be thrown for the expected invocation.
| |
| andVoid | back to summary |
|---|---|
| public IExpectationSetters Implements org. Doc from org. Records a call but returns nothing. Used to chain calls on void methods
| |
| anyTimes | back to summary |
|---|---|
| public IExpectationSetters Implements org. Doc from org. Expect the last invocation any times.
| |
| asStub | back to summary |
|---|---|
| public void asStub() Implements org. Doc from org. Sets stub behavior for the expected invocation (this is needed for void methods).
| |
| atLeastOnce | back to summary |
|---|---|
| public IExpectationSetters Implements org. Doc from org. Expect the last invocation at least once.
| |
| checkInterfaceHasDefaultMethodAndIsMockingOnlyThem | back to summary |
|---|---|
| private <T> void checkInterfaceHasDefaultMethodAndIsMockingOnlyThem(Class<T> toMock, Method[] mockedMethods) | |
| checkIsUsedInOneThread | back to summary |
|---|---|
| public void checkIsUsedInOneThread(boolean shouldBeUsedInOneThread) Implements org. Doc from org. Check that the mock is called from only one thread
| |
| checkOrder | back to summary |
|---|---|
| public void checkOrder(boolean value) Implements org. Doc from org. Switches order checking on and off.
| |
| createMock | back to summary |
|---|---|
| public <T, R> R createMock(Class<T> toMock) Implements org. Doc from org. Same as
| |
| createMock | back to summary |
|---|---|
| public <T, R> R createMock(String name, Class<T> toMock) Implements org. Doc from org. Same as
| |
| createMock | back to summary |
|---|---|
| public <T, R> R createMock(String name, Class<T> toMock, ConstructorArgs constructorArgs, Method... mockedMethods) Implements org. Doc from org. Same as
| |
| getClassProxyFactory | back to summary |
|---|---|
| private static IProxyFactory getClassProxyFactory() | |
| getControl | back to summary |
|---|---|
| public static MocksControl getControl(Object mock) | |
| getInvocationHandler | back to summary |
|---|---|
| public static InvocationHandler getInvocationHandler(Object mock) | |
| getMockedClass | back to summary |
|---|---|
| public static <T, R extends T> Class Return the class of interface (depending on the mock type) that was mocked
| |
| getProxyFactory | back to summary |
|---|---|
| public static IProxyFactory getProxyFactory(Object o) | |
| getState | back to summary |
|---|---|
| public IMocksControlState getState() | |
| getType | back to summary |
|---|---|
| public MockType getType() | |
| makeThreadSafe | back to summary |
|---|---|
| public void makeThreadSafe(boolean threadSafe) Implements org. Doc from org. Makes the mock thread safe.
| |
| once | back to summary |
|---|---|
| public IExpectationSetters Implements org. Doc from org. Expect the last invocation once. This is default in EasyMock.
| |
| replay | back to summary |
|---|---|
| public void replay() Implements org. Doc from org. Switches the control from record mode to replay mode.
| |
| reset | back to summary |
|---|---|
| public void reset() Implements org. Doc from org. Removes all expectations for the mock objects of this control.
| |
| resetToDefault | back to summary |
|---|---|
| public void resetToDefault() Implements org. Doc from org. Removes all expectations for the mock objects of this control and turn them to default mocks.
| |
| resetToNice | back to summary |
|---|---|
| public void resetToNice() Implements org. Doc from org. Removes all expectations for the mock objects of this control and turn them to nice mocks.
| |
| resetToStrict | back to summary |
|---|---|
| public void resetToStrict() Implements org. Doc from org. Removes all expectations for the mock objects of this control and turn them to strict mocks.
| |
| times | back to summary |
|---|---|
| public IExpectationSetters Implements org. Doc from org. Expect the last invocation
| |
| times | back to summary |
|---|---|
| public IExpectationSetters Implements org. Doc from org. Expect the last invocation between
| |
| verify | back to summary |
|---|---|
| public void verify() Implements org. Doc from org. Verifies that all expectations were met and that no unexpected
call was performed. It has the same effect as calling
| |
| verifyRecording | back to summary |
|---|---|
| public void verifyRecording() Implements org. Doc from org. Verifies that all expectations were met.
| |
| verifyUnexpectedCalls | back to summary |
|---|---|
| public void verifyUnexpectedCalls() Implements org. Doc from org. Verifies that no unexpected call was performed.
| |