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

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

public class OngoingStubbingImpl<T>
extends BaseStubbing<T>


Constructor Summary
OngoingStubbingImpl(InvocationContainerImpl invocationContainerImpl)
           
 
Method Summary
 java.util.List<Invocation> getRegisteredInvocations()
           
 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

OngoingStubbingImpl

public OngoingStubbingImpl(InvocationContainerImpl invocationContainerImpl)
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

getRegisteredInvocations

public java.util.List<Invocation> getRegisteredInvocations()