org.mockito.internal.stubbing
Class ConsecutiveStubbing<T>

java.lang.Object
  extended by org.mockito.internal.stubbing.BaseStubbing<T>
      extended by org.mockito.internal.stubbing.ConsecutiveStubbing<T>
All Implemented Interfaces:
IOngoingStubbing, DeprecatedOngoingStubbing<T>, OngoingStubbing<T>

public class ConsecutiveStubbing<T>
extends BaseStubbing<T>


Constructor Summary
ConsecutiveStubbing(MockitoStubber mockitoStubber)
           
 
Method Summary
 OngoingStubbing<T> thenAnswer(Answer<?> answer)
          Sets a generic Answer for the method.
 DeprecatedOngoingStubbing<T> toAnswer(Answer<?> answer)
          Set a generic Answer for the stubbed method.
 
Methods inherited from class org.mockito.internal.stubbing.BaseStubbing
thenCallRealMethod, thenReturn, thenReturn, thenThrow, toReturn, toThrow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsecutiveStubbing

public ConsecutiveStubbing(MockitoStubber mockitoStubber)
Method Detail

thenAnswer

public OngoingStubbing<T> thenAnswer(Answer<?> answer)
Description copied from interface: OngoingStubbing
Sets a generic Answer for the method. E.g:
 when(mock.someMethod(10)).thenAnswer(new Answer<Integer>() {
     public Integer answer(InvocationOnMock invocation) throws Throwable {
         return (Integer) invocation.getArguments()[0];
     }
 }
 

Parameters:
answer - the custom answer to execute.
Returns:
iOngoingStubbing object that allows stubbing consecutive calls

toAnswer

public DeprecatedOngoingStubbing<T> toAnswer(Answer<?> answer)
Description copied from interface: DeprecatedOngoingStubbing
Set a generic Answer for the stubbed method. E.g:
 stub(mock.someMethod(10)).toAnswer(new Answer<Integer>() {
     public Integer answer(InvocationOnMock invocation) throws Throwable {
         return (Integer) invocation.getArguments()[0];
     }
 }
 

Parameters:
answer - the custom answer to execute.
Returns:
iOngoingStubbing object that allows stubbing consecutive calls