org.easymock
Interface IExpectationSetters<T>
public interface IExpectationSetters<T>
Allows setting expectations for an associated expected invocation.
Implementations of this interface are returned by
EasyMock.expect(Object)
, and by EasyMock.expectLastCall()
.
IExpectationSetters | andAnswer(IAnswer 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 | andReturn(T value) - Sets a return value that will be returned for the expected invocation.
|
void | andStubAnswer(IAnswer 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(Object value) - Sets a stub return value that will be returned for the expected
invocation.
|
void | andStubThrow(Throwable throwable) - Sets a stub throwable that will be thrown for the expected invocation.
|
IExpectationSetters | andThrow(Throwable throwable) - Sets a throwable that will be thrown for the expected invocation.
|
IExpectationSetters | anyTimes() - Expect the last invocation any times.
|
void | asStub() - Sets stub behavior for the expected invocation (this is needed for void
methods).
|
IExpectationSetters | atLeastOnce() - Expect the last invocation at least once.
|
IExpectationSetters | once() - Expect the last invocation once.
|
IExpectationSetters | times(int count) - Expect the last invocation
count times.
|
IExpectationSetters | times(int min, int max) - Expect the last invocation between
min and
max times.
|
andAnswer
public IExpectationSetters andAnswer(IAnswer answer)
Sets an object that will be used to calculate the answer for the expected
invocation (either return a value, or throw an exception).
answer
- the object used to answer the invocation.
- this object to allow method call chaining.
andReturn
public IExpectationSetters andReturn(T value)
Sets a return value that will be returned for the expected invocation.
value
- the value to return.
- this object to allow method call chaining.
andStubAnswer
public void andStubAnswer(IAnswer 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).
answer
- the object used to answer the invocation.
andStubReturn
public void andStubReturn(Object value)
Sets a stub return value that will be returned for the expected
invocation.
value
- the value to return.
andStubThrow
public void andStubThrow(Throwable throwable)
Sets a stub throwable that will be thrown for the expected invocation.
throwable
- the throwable to throw.
andThrow
public IExpectationSetters andThrow(Throwable throwable)
Sets a throwable that will be thrown for the expected invocation.
throwable
- the throwable to throw.
- this object to allow method call chaining.
anyTimes
public IExpectationSetters anyTimes()
Expect the last invocation any times.
- this object to allow method call chaining.
asStub
public void asStub()
Sets stub behavior for the expected invocation (this is needed for void
methods).
atLeastOnce
public IExpectationSetters atLeastOnce()
Expect the last invocation at least once.
- this object to allow method call chaining.
once
public IExpectationSetters once()
Expect the last invocation once. This is default in EasyMock.
- this object to allow method call chaining.
times
public IExpectationSetters times(int count)
Expect the last invocation count
times.
count
- the number of invocations expected.
- this object to allow method call chaining.
times
public IExpectationSetters times(int min,
int max)
Expect the last invocation between min
and
max
times.
min
- the minimum number of invocations expected.max
- the maximum number of invocations expected.
- this object to allow method call chaining.