org.easymock
Interface IExpectationSetters<T>

All Known Subinterfaces:
IMocksControl

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().


Method Summary
 IExpectationSetters<T> andReturn(T value)
          Sets a return value that should be returned for the expected invocation.
 void andStubReturn(java.lang.Object value)
          Sets a stub return value that should be returned for the expected invocation.
 void andStubThrow(java.lang.Throwable throwable)
          Sets a stub throwable that should be thrown for the expected invocation.
 IExpectationSetters<T> andThrow(java.lang.Throwable throwable)
          Sets a throwable that should be thrown for the expected invocation.
 IExpectationSetters<T> anyTimes()
          Expect the last invocation any times.
 void asStub()
          Sets stub behavior for the expected invocation (this is needed for void methods).
 IExpectationSetters<T> atLeastOnce()
          Expect the last invocation at least once.
 IExpectationSetters<T> callback(java.lang.Runnable callback)
          Sets a callback that should be called for the expected invocation.
 IExpectationSetters<T> once()
          Expect the last invocation once.
 IExpectationSetters<T> times(int count)
          Expect the last invocation count times.
 IExpectationSetters<T> times(int min, int max)
          Expect the last invocation between min and max times.
 

Method Detail

andReturn

IExpectationSetters<T> andReturn(T value)
Sets a return value that should be returned for the expected invocation.

Parameters:
value - the value to return.
Returns:
this object to allow method call chaining.

andThrow

IExpectationSetters<T> andThrow(java.lang.Throwable throwable)
Sets a throwable that should be thrown for the expected invocation.

Parameters:
throwable - the throwable to throw.
Returns:
this object to allow method call chaining.

andStubReturn

void andStubReturn(java.lang.Object value)
Sets a stub return value that should be returned for the expected invocation.

Parameters:
value - the value to return.

andStubThrow

void andStubThrow(java.lang.Throwable throwable)
Sets a stub throwable that should be thrown for the expected invocation.

Parameters:
throwable - the throwable to throw.

asStub

void asStub()
Sets stub behavior for the expected invocation (this is needed for void methods).


callback

IExpectationSetters<T> callback(java.lang.Runnable callback)
Sets a callback that should be called for the expected invocation.

Parameters:
callback - the callback to call.
Returns:
this object to allow method call chaining.

times

IExpectationSetters<T> times(int count)
Expect the last invocation count times.

Parameters:
count - the number of invocations expected.
Returns:
this object to allow method call chaining.

times

IExpectationSetters<T> times(int min,
                             int max)
Expect the last invocation between min and max times.

Parameters:
min - the minimum number of invocations expected.
max - the maximum number of invocations expected.
Returns:
this object to allow method call chaining.

once

IExpectationSetters<T> once()
Expect the last invocation once. This is default in EasyMock.

Returns:
this object to allow method call chaining.

atLeastOnce

IExpectationSetters<T> atLeastOnce()
Expect the last invocation at least once.

Returns:
this object to allow method call chaining.

anyTimes

IExpectationSetters<T> anyTimes()
Expect the last invocation any times.

Returns:
this object to allow method call chaining.


Copyright © 2001-2005 OFFIS, Tammo Freese. This documentation is provided under the terms of the MIT licence.