/** * Creates {@link org.mockito.InOrder} object that allows verifying mocks in order. * * <pre class="code"><code class="java"> * InOrder inOrder = inOrder(firstMock, secondMock); * * inOrder.verify(firstMock).add("was called first"); * inOrder.verify(secondMock).add("was called second"); * </code></pre> * * Verification in order is flexible - <b>you don't have to verify all interactions</b> one-by-one * but only those that you are interested in testing in order. * <p> * Also, you can create InOrder object passing only mocks that are relevant for in-order verification. * <p> * <code>InOrder</code> verification is 'greedy'. You will hardly every notice it but * if you want to find out more search for 'greedy' on the Mockito * <a href="http://code.google.com/p/mockito/w/list">wiki pages</a>. * <p> * As of Mockito 1.8.4 you can verifyNoMoreInvocations() in order-sensitive way. Read more: {@link InOrder#verifyNoMoreInteractions()} * <p> * See examples in javadoc for {@link Mockito} class * * @param mocks to be verified in order * * @return InOrder object to be used to verify in order */ public static InOrder inOrder(Object... mocks) { return MOCKITO_CORE.inOrder(mocks); }
return MOCKITO_CORE.inOrder(mocks);
/** * Creates InOrder object that allows verifying mocks in order. * * <pre> * InOrder inOrder = inOrder(firstMock, secondMock); * * inOrder.verify(firstMock).add("was called first"); * inOrder.verify(secondMock).add("was called second"); * </pre> * * Verification in order is flexible - <b>you don't have to verify all interactions</b> one-by-one * but only those that you are interested in testing in order. * <p> * Also, you can create InOrder object passing only mocks that are relevant for in-order verification. * <p> * InOrder verification is 'greedy'. You will hardly every notice it but * if you want to find out more search for 'greedy' on the Mockito * <a href="http://code.google.com/p/mockito/w/list">wiki pages</a>. * <p> * As of Mockito 1.8.4 you can verifyNoMoreInvocations() in order-sensitive way. Read more: {@link InOrder#verifyNoMoreInteractions()} * <p> * See examples in javadoc for {@link Mockito} class * * @param mocks to be verified in order * * @return InOrder object to be used to verify in order */ public static InOrder inOrder(Object... mocks) { return MOCKITO_CORE.inOrder(mocks); }