Class ConsecutiveStubbing<T>

java.lang.Object
org.mockito.internal.stubbing.BaseStubbing<T>
org.mockito.internal.stubbing.ConsecutiveStubbing<T>
All Implemented Interfaces:
OngoingStubbing<T>

public class ConsecutiveStubbing<T> extends BaseStubbing<T>
  • Method Details

    • 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:
      object that allows stubbing consecutive calls