|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.easymock.internal.MocksControl
public class MocksControl
| Nested Class Summary | |
|---|---|
static class |
MocksControl.MockType
|
| Field Summary | |
|---|---|
static Range |
AT_LEAST_ONCE
One or more calls. |
static Range |
ONCE
Exactly one call. |
static Range |
ZERO_OR_MORE
Zero or more calls. |
| Constructor Summary | |
|---|---|
MocksControl(MocksControl.MockType type)
|
|
| Method Summary | ||
|---|---|---|
IExpectationSetters<java.lang.Object> |
andAnswer(IAnswer<? extends java.lang.Object> answer)
Sets an object that will be used to calculate the answer for the expected invocation (either return a value, or throw an exception). |
|
IExpectationSetters<java.lang.Object> |
andReturn(java.lang.Object value)
Sets a return value that will be returned for the expected invocation. |
|
void |
andStubAnswer(IAnswer<? extends java.lang.Object> answer)
Sets a stub object that will be used to calculate the answer for the expected invocation (either return a value, or throw an exception). |
|
void |
andStubReturn(java.lang.Object value)
Sets a stub return value that will be returned for the expected invocation. |
|
void |
andStubThrow(java.lang.Throwable throwable)
Sets a stub throwable that will be thrown for the expected invocation. |
|
IExpectationSetters<java.lang.Object> |
andThrow(java.lang.Throwable throwable)
Sets a throwable that will be thrown for the expected invocation. |
|
IExpectationSetters<java.lang.Object> |
anyTimes()
Expect the last invocation any times. |
|
void |
asStub()
Sets stub behavior for the expected invocation (this is needed for void methods). |
|
IExpectationSetters<java.lang.Object> |
atLeastOnce()
Expect the last invocation at least once. |
|
void |
checkOrder(boolean value)
Switches order checking on and off. |
|
|
createMock(java.lang.Class<T> toMock)
Creates a mock object that implements the given interface. |
|
|
createMock(java.lang.String name,
java.lang.Class<T> toMock)
Creates a mock object that implements the given interface. |
|
protected
|
createProxyFactory(java.lang.Class<T> toMock)
|
|
IMocksControlState |
getState()
|
|
void |
makeThreadSafe(boolean threadSafe)
Makes the mock thread safe. |
|
IExpectationSetters<java.lang.Object> |
once()
Expect the last invocation once. |
|
void |
replay()
Switches the control from record mode to replay mode. |
|
void |
reset()
Removes all expectations for the mock objects of this control. |
|
void |
resetToDefault()
Removes all expectations for the mock objects of this control and turn them to default mocks. |
|
void |
resetToNice()
Removes all expectations for the mock objects of this control and turn them to nice mocks. |
|
void |
resetToStrict()
Removes all expectations for the mock objects of this control and turn them to strict mocks. |
|
void |
setLegacyDefaultMatcher(ArgumentsMatcher matcher)
|
|
void |
setLegacyDefaultReturnValue(java.lang.Object value)
|
|
void |
setLegacyDefaultThrowable(java.lang.Throwable throwable)
|
|
void |
setLegacyDefaultVoidCallable()
|
|
void |
setLegacyMatcher(ArgumentsMatcher matcher)
|
|
IExpectationSetters<java.lang.Object> |
times(int times)
Expect the last invocation count times. |
|
IExpectationSetters<java.lang.Object> |
times(int min,
int max)
Expect the last invocation between min and
max times. |
|
void |
verify()
Verifies that all expectations were met. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Range ONCE
public static final Range AT_LEAST_ONCE
public static final Range ZERO_OR_MORE
| Constructor Detail |
|---|
public MocksControl(MocksControl.MockType type)
| Method Detail |
|---|
public IMocksControlState getState()
public <T> T createMock(java.lang.Class<T> toMock)
IMocksControl
createMock in interface IMocksControlT - the interface that the mock object should implement.toMock - the class of the interface that the mock object should implement.
public <T> T createMock(java.lang.String name,
java.lang.Class<T> toMock)
IMocksControl
createMock in interface IMocksControlT - the interface that the mock object should implement.name - the name of the mock object .toMock - the class of the interface that the mock object should implement.
protected <T> IProxyFactory<T> createProxyFactory(java.lang.Class<T> toMock)
public final void reset()
IMocksControl
reset in interface IMocksControlpublic void resetToNice()
IMocksControl
resetToNice in interface IMocksControlpublic void resetToDefault()
IMocksControl
resetToDefault in interface IMocksControlpublic void resetToStrict()
IMocksControl
resetToStrict in interface IMocksControlpublic void replay()
IMocksControl
replay in interface IMocksControlpublic void verify()
IMocksControl
verify in interface IMocksControlpublic void checkOrder(boolean value)
IMocksControl
checkOrder in interface IMocksControlvalue - true switches order checking on, false switches it off.public void makeThreadSafe(boolean threadSafe)
IMocksControl
makeThreadSafe in interface IMocksControlthreadSafe - If the mock should be thread safe or notpublic IExpectationSetters<java.lang.Object> andReturn(java.lang.Object value)
IExpectationSetters
andReturn in interface IExpectationSetters<java.lang.Object>value - the value to return.
public IExpectationSetters<java.lang.Object> andThrow(java.lang.Throwable throwable)
IExpectationSetters
andThrow in interface IExpectationSetters<java.lang.Object>throwable - the throwable to throw.
public IExpectationSetters<java.lang.Object> andAnswer(IAnswer<? extends java.lang.Object> answer)
IExpectationSetters
andAnswer in interface IExpectationSetters<java.lang.Object>answer - the object used to answer the invocation.
public void andStubReturn(java.lang.Object value)
IExpectationSetters
andStubReturn in interface IExpectationSetters<java.lang.Object>value - the value to return.public void andStubThrow(java.lang.Throwable throwable)
IExpectationSetters
andStubThrow in interface IExpectationSetters<java.lang.Object>throwable - the throwable to throw.public void andStubAnswer(IAnswer<? extends java.lang.Object> answer)
IExpectationSetters
andStubAnswer in interface IExpectationSetters<java.lang.Object>answer - the object used to answer the invocation.public void asStub()
IExpectationSetters
asStub in interface IExpectationSetters<java.lang.Object>public IExpectationSetters<java.lang.Object> times(int times)
IExpectationSetterscount times.
times in interface IExpectationSetters<java.lang.Object>times - the number of invocations expected.
public IExpectationSetters<java.lang.Object> times(int min,
int max)
IExpectationSettersmin and
max times.
times in interface IExpectationSetters<java.lang.Object>min - the minimum number of invocations expected.max - the maximum number of invocations expected.
public IExpectationSetters<java.lang.Object> once()
IExpectationSetters
once in interface IExpectationSetters<java.lang.Object>public IExpectationSetters<java.lang.Object> atLeastOnce()
IExpectationSetters
atLeastOnce in interface IExpectationSetters<java.lang.Object>public IExpectationSetters<java.lang.Object> anyTimes()
IExpectationSetters
anyTimes in interface IExpectationSetters<java.lang.Object>public void setLegacyDefaultMatcher(ArgumentsMatcher matcher)
public void setLegacyMatcher(ArgumentsMatcher matcher)
public void setLegacyDefaultReturnValue(java.lang.Object value)
public void setLegacyDefaultVoidCallable()
public void setLegacyDefaultThrowable(java.lang.Throwable throwable)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||