org.mockito
Interface InOrder


public interface InOrder

Allows verification in order. E.g:

 InOrder inOrder = inOrder(firstMock, secondMock);
 
 inOrder.verify(firstMock).add("was called first");
 inOrder.verify(secondMock).add("was called second");
 
See examples in javadoc for Mockito class


Method Summary
<T> T
verify(T mock)
          Verifies interaction happened once in order.
<T> T
verify(T mock, VerificationMode mode)
          Verifies interaction in order.
 

Method Detail

verify

<T> T verify(T mock)
Verifies interaction happened once in order.

Alias to inOrder.verify(mock, times(1))

Example:

 InOrder inOrder = inOrder(firstMock, secondMock);
 
 inOrder.verify(firstMock).someMethod("was called first");
 inOrder.verify(secondMock).someMethod("was called second");
 
See examples in javadoc for Mockito class

Parameters:
mock - to be verified
Returns:
mock object itself

verify

<T> T verify(T mock,
             VerificationMode mode)
Verifies interaction in order. E.g:
 InOrder inOrder = inOrder(firstMock, secondMock);
 
 inOrder.verify(firstMock, times(2)).someMethod("was called first two times");
 inOrder.verify(secondMock, atLeastOnce()).someMethod("was called second at least once");
 
See examples in javadoc for Mockito class

Parameters:
mock - to be verified
mode - for example times(x) or atLeastOnce()
Returns:
mock object itself