|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.easymock.MockControl<T>
T
- type of the mock controlledEasyMock
are
used to create and control mock objects.
@Deprecated public class MockControl<T>
A MockControl
object controls the behavior of its associated
mock object. For more information, see the EasyMock documentation.
Field Summary | |
---|---|
static ArgumentsMatcher |
ALWAYS_MATCHER
Deprecated. Matches always. |
static ArgumentsMatcher |
ARRAY_MATCHER
Deprecated. Matches if each expected argument is equal to the corresponding actual argument for non-array arguments; array arguments are compared with the appropriate java.util.Arrays.equals() -method. |
static ArgumentsMatcher |
EQUALS_MATCHER
Deprecated. Matches if each expected argument is equal to the corresponding actual argument. |
static org.easymock.internal.Range |
ONE
Deprecated. Exactly one call. |
static org.easymock.internal.Range |
ONE_OR_MORE
Deprecated. One or more calls. |
static org.easymock.internal.Range |
ZERO_OR_MORE
Deprecated. Zero or more calls. |
Constructor Summary | |
---|---|
protected |
MockControl(org.easymock.internal.MocksControl ctrl,
java.lang.Class<T> toMock)
Deprecated. |
Method Summary | ||
---|---|---|
static
|
createControl(java.lang.Class<T> toMock)
Deprecated. Creates a mock control object for the specified interface. |
|
static
|
createNiceControl(java.lang.Class<T> toMock)
Deprecated. Creates a mock control object for the specified interface. |
|
static
|
createStrictControl(java.lang.Class<T> toMock)
Deprecated. Creates a mock control object for the specified interface. |
|
|
expectAndDefaultReturn(V1 ignored,
V2 value)
Deprecated. Same as setDefaultReturnValue(Object) . |
|
void |
expectAndDefaultThrow(java.lang.Object ignored,
java.lang.Throwable throwable)
Deprecated. Same as setDefaultThrowable(Throwable) . |
|
void |
expectAndReturn(int ignored,
int value)
Deprecated. |
|
void |
expectAndReturn(int ignored,
int value,
int count)
Deprecated. |
|
void |
expectAndReturn(int ignored,
int value,
int min,
int max)
Deprecated. |
|
void |
expectAndReturn(int ignored,
int value,
org.easymock.internal.Range range)
Deprecated. |
|
|
expectAndReturn(V1 ignored,
V2 value)
Deprecated. Same as setReturnValue(Object) . |
|
|
expectAndReturn(V1 ignored,
V2 value,
int count)
Deprecated. Same as setReturnValue(Object, int) . |
|
|
expectAndReturn(V1 ignored,
V2 value,
int min,
int max)
Deprecated. Same as setReturnValue(Object, int, int) . |
|
|
expectAndReturn(V1 ignored,
V2 value,
org.easymock.internal.Range range)
Deprecated. Same as setReturnValue(Object, Range) . |
|
void |
expectAndThrow(java.lang.Object ignored,
java.lang.Throwable throwable)
Deprecated. Same as setThrowable(Throwable) . |
|
void |
expectAndThrow(java.lang.Object ignored,
java.lang.Throwable throwable,
int count)
Deprecated. Same as setThrowable(Throwable, int) . |
|
void |
expectAndThrow(java.lang.Object ignored,
java.lang.Throwable throwable,
int min,
int max)
Deprecated. Same as setThrowable(Throwable, int, int) . |
|
void |
expectAndThrow(java.lang.Object ignored,
java.lang.Throwable throwable,
org.easymock.internal.Range range)
Deprecated. Same as setThrowable(Throwable, Range) . |
|
T |
getMock()
Deprecated. Returns the mock object. |
|
void |
replay()
Deprecated. Switches the mock object from record state to replay state. |
|
void |
reset()
Deprecated. Resets the mock control and the mock object to the state directly after creation. |
|
void |
setDefaultMatcher(ArgumentsMatcher matcher)
Deprecated. Sets the default ArgumentsMatcher for all methods of the mock object. |
|
void |
setDefaultReturnValue(java.lang.Object value)
Deprecated. Records that the mock object will by default allow the last method specified by a method call, and will react by returning the provided return value. |
|
void |
setDefaultThrowable(java.lang.Throwable throwable)
Deprecated. Records that the mock object will by default allow the last method specified by a method call, and will react by throwing the provided Throwable. |
|
void |
setDefaultVoidCallable()
Deprecated. Records that the mock object will by default allow the last method specified by a method call. |
|
void |
setMatcher(ArgumentsMatcher matcher)
Deprecated. Sets the ArgumentsMatcher for the last method called on the mock object. |
|
void |
setReturnValue(java.lang.Object value)
Deprecated. Records that the mock object will expect the last method call once, and will react by returning the provided return value. |
|
void |
setReturnValue(java.lang.Object value,
int times)
Deprecated. Records that the mock object will expect the last method call a fixed number of times, and will react by returning the provided return value. |
|
void |
setReturnValue(java.lang.Object value,
int minCount,
int maxCount)
Deprecated. Records that the mock object will expect the last method call between minCount and maxCount times, and will react
by returning the provided return value. |
|
void |
setReturnValue(java.lang.Object value,
org.easymock.internal.Range range)
Deprecated. Records that the mock object will expect the last method call a fixed number of times, and will react by returning the provided return value. |
|
void |
setThrowable(java.lang.Throwable throwable)
Deprecated. Records that the mock object will expect the last method call once, and will react by throwing the provided Throwable. |
|
void |
setThrowable(java.lang.Throwable throwable,
int times)
Deprecated. Records that the mock object will expect the last method call a fixed number of times, and will react by throwing the provided Throwable. |
|
void |
setThrowable(java.lang.Throwable throwable,
int minCount,
int maxCount)
Deprecated. Records that the mock object will expect the last method call between minCount and maxCount times, and will react
by throwing the provided Throwable. |
|
void |
setThrowable(java.lang.Throwable throwable,
org.easymock.internal.Range range)
Deprecated. |
|
void |
setVoidCallable()
Deprecated. Records that the mock object will expect the last method call once, and will react by returning silently. |
|
void |
setVoidCallable(int times)
Deprecated. Records that the mock object will expect the last method call a fixed number of times, and will react by returning silently. |
|
void |
setVoidCallable(int minCount,
int maxCount)
Deprecated. Records that the mock object will expect the last method call between minCount and maxCount times, and will react
by returning silently. |
|
void |
setVoidCallable(org.easymock.internal.Range range)
Deprecated. |
|
void |
verify()
Deprecated. Verifies that all expectations have been met. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.easymock.internal.Range ONE
public static final org.easymock.internal.Range ONE_OR_MORE
public static final org.easymock.internal.Range ZERO_OR_MORE
public static final ArgumentsMatcher EQUALS_MATCHER
public static final ArgumentsMatcher ALWAYS_MATCHER
public static final ArgumentsMatcher ARRAY_MATCHER
java.util.Arrays.equals()
-method.
Constructor Detail |
---|
protected MockControl(org.easymock.internal.MocksControl ctrl, java.lang.Class<T> toMock)
Method Detail |
---|
public static <T> MockControl<T> createControl(java.lang.Class<T> toMock)
MockControl
and its associated mock object will not check
the order of expected method calls. An unexpected method call on the mock
object will lead to an AssertionError
.
T
- type of the mock controlledtoMock
- the class of the interface to mock.
public static <T> MockControl<T> createStrictControl(java.lang.Class<T> toMock)
MockControl
and its associated mock object will check the
order of expected method calls. An unexpected method call on the mock
object will lead to an AssertionError
.
T
- type of the mock controlledtoMock
- the class of the interface to mock.
public static <T> MockControl<T> createNiceControl(java.lang.Class<T> toMock)
MockControl
and its associated mock object will not check
the order of expected method calls. An unexpected method call on the mock
object will return an empty value (0, null, false).
T
- type of the mock controlledtoMock
- the class of the interface to mock.
public T getMock()
public final void reset()
public void replay()
java.lang.IllegalStateException
- if the mock object already is in replay state.public void verify()
java.lang.IllegalStateException
- if the mock object is in record state.
java.lang.AssertionError
- if any expectation has not been met.public void setVoidCallable()
java.lang.IllegalStateException
- if the mock object is in replay state, if no method was
called on the mock object before, or if the last method
called on the mock was no void method.public void setThrowable(java.lang.Throwable throwable)
throwable
- the Throwable to throw.
java.lang.IllegalStateException
- if the mock object is in replay state or if no method was
called on the mock object before.
java.lang.IllegalArgumentException
- if the last method called on the mock cannot throw the
provided Throwable.
java.lang.NullPointerException
- if throwable is null.public void setReturnValue(java.lang.Object value)
value
- the return value.
java.lang.IllegalStateException
- if the mock object is in replay state, if no method was
called on the mock object before. or if the last method
called on the mock does not return boolean
.public void setVoidCallable(int times)
times
- the number of times that the call is expected.
java.lang.IllegalStateException
- if the mock object is in replay state, if no method was
called on the mock object before, or if the last method
called on the mock was no void method.public void setThrowable(java.lang.Throwable throwable, int times)
throwable
- the Throwable to throw.times
- the number of times that the call is expected.
java.lang.IllegalStateException
- if the mock object is in replay state or if no method was
called on the mock object before.
java.lang.IllegalArgumentException
- if the last method called on the mock cannot throw the
provided Throwable.
java.lang.NullPointerException
- if throwable is null.public void setReturnValue(java.lang.Object value, int times)
value
- the return value.times
- the number of times that the call is expected.
java.lang.IllegalStateException
- if the mock object is in replay state, if no method was
called on the mock object before. or if the last method
called on the mock does not return boolean
.public void setReturnValue(java.lang.Object value, org.easymock.internal.Range range)
value
- the return value.range
- the number of times that the call is expected.
java.lang.IllegalStateException
- if the mock object is in replay state, if no method was
called on the mock object before. or if the last method
called on the mock does not return boolean
.public void setDefaultVoidCallable()
java.lang.IllegalStateException
- if the mock object is in replay state, if no method was
called on the mock object before, or if the last method
called on the mock was no void method.public void setDefaultThrowable(java.lang.Throwable throwable)
throwable
- throwable the throwable to be thrown
java.lang.IllegalArgumentException
- if the last method called on the mock cannot throw the
provided Throwable.
java.lang.NullPointerException
- if throwable is null.
java.lang.IllegalStateException
- if the mock object is in replay state, or if no method was
called on the mock object before.public void setDefaultReturnValue(java.lang.Object value)
value
- the return value.
java.lang.IllegalStateException
- if the mock object is in replay state, if no method was
called on the mock object before. or if the last method
called on the mock does not return boolean
.public void setMatcher(ArgumentsMatcher matcher)
matcher
- the matcher for the last method called
java.lang.IllegalStateException
- if called in replay state, or if no method was called on the
mock object before.public void setVoidCallable(int minCount, int maxCount)
minCount
and maxCount
times, and will react
by returning silently.
minCount
- the minimum number of times that the call is expected.maxCount
- the maximum number of times that the call is expected.
java.lang.IllegalStateException
- if the mock object is in replay state, if no method was
called on the mock object before, or if the last method
called on the mock was no void method.public void setVoidCallable(org.easymock.internal.Range range)
public void setThrowable(java.lang.Throwable throwable, int minCount, int maxCount)
minCount
and maxCount
times, and will react
by throwing the provided Throwable.
throwable
- the Throwable to throw.minCount
- the minimum number of times that the call is expected.maxCount
- the maximum number of times that the call is expected.
java.lang.IllegalStateException
- if the mock object is in replay state or if no method was
called on the mock object before.
java.lang.IllegalArgumentException
- if the last method called on the mock cannot throw the
provided Throwable.
java.lang.NullPointerException
- if throwable is null.public void setThrowable(java.lang.Throwable throwable, org.easymock.internal.Range range)
public void setReturnValue(java.lang.Object value, int minCount, int maxCount)
minCount
and maxCount
times, and will react
by returning the provided return value.
value
- the return value.minCount
- the minimum number of times that the call is expected.maxCount
- the maximum number of times that the call is expected.
java.lang.IllegalStateException
- if the mock object is in replay state, if no method was
called on the mock object before. or if the last method
called on the mock does not return boolean
.public void setDefaultMatcher(ArgumentsMatcher matcher)
matcher
- the default matcher for this control
java.lang.IllegalStateException
- if called in replay state, or if any behavior is already
defined on the mock object.public <V1,V2 extends V1> void expectAndReturn(V1 ignored, V2 value)
setReturnValue(Object)
. For explanation, see
"Convenience Methods for Return Values" in the EasyMock documentation.
V1
- mocked method return typeV2
- returned value typeignored
- an ignored value.value
- value returned by the mockpublic void expectAndReturn(int ignored, int value)
public <V1,V2 extends V1> void expectAndReturn(V1 ignored, V2 value, org.easymock.internal.Range range)
setReturnValue(Object, Range)
. For
explanation, see "Convenience Methods for Return Values" in the EasyMock
documentation.
V1
- mocked method return typeV2
- returned value typeignored
- an ignored value.value
- value returned by the mockrange
- range of number of callspublic void expectAndReturn(int ignored, int value, org.easymock.internal.Range range)
public <V1,V2 extends V1> void expectAndReturn(V1 ignored, V2 value, int count)
setReturnValue(Object, int)
. For
explanation, see "Convenience Methods for Return Values" in the EasyMock
documentation.
V1
- mocked method return typeV2
- returned value typeignored
- an ignored value.value
- value returned by the mockcount
- number of times the call is expectedpublic void expectAndReturn(int ignored, int value, int count)
public <V1,V2 extends V1> void expectAndReturn(V1 ignored, V2 value, int min, int max)
setReturnValue(Object, int, int)
. For
explanation, see "Convenience Methods for Return Values" in the EasyMock
documentation.
V1
- mocked method return typeV2
- returned value typeignored
- an ignored value.value
- value returned by the mockmin
- minimum number of times the call is expectedmax
- maximum number of times the call is expectedpublic void expectAndReturn(int ignored, int value, int min, int max)
public void expectAndThrow(java.lang.Object ignored, java.lang.Throwable throwable)
setThrowable(Throwable)
. For explanation,
see "Convenience Methods for Throwables" in the EasyMock documentation.
ignored
- an ignored value.throwable
- to be thrown on the callpublic void expectAndThrow(java.lang.Object ignored, java.lang.Throwable throwable, org.easymock.internal.Range range)
setThrowable(Throwable, Range)
. For
explanation, see "Convenience Methods for Throwables" in the EasyMock
documentation.
ignored
- an ignored value.throwable
- to be thrown on the callrange
- range of number of callspublic void expectAndThrow(java.lang.Object ignored, java.lang.Throwable throwable, int count)
setThrowable(Throwable, int)
. For
explanation, see "Convenience Methods for Throwables" in the EasyMock
documentation.
ignored
- an ignored value.throwable
- to be thrown on the callcount
- number of times the call is expectedpublic void expectAndThrow(java.lang.Object ignored, java.lang.Throwable throwable, int min, int max)
setThrowable(Throwable, int, int)
. For
explanation, see "Convenience Methods for Throwables" in the EasyMock
documentation.
ignored
- an ignored value.throwable
- to be thrown on the callmin
- minimum number of times the call is expectedmax
- maximum number of times the call is expectedpublic <V1,V2 extends V1> void expectAndDefaultReturn(V1 ignored, V2 value)
setDefaultReturnValue(Object)
. For
explanation, see "Convenience Methods for Return Values" in the EasyMock
documentation.
V1
- mocked method return typeV2
- returned value typeignored
- an ignored value.value
- value returned by the mockpublic void expectAndDefaultThrow(java.lang.Object ignored, java.lang.Throwable throwable)
setDefaultThrowable(Throwable)
. For
explanation, see "Convenience Methods for Throwables" in the EasyMock
documentation.
ignored
- an ignored value.throwable
- to be thrown on the call
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |