/* * Copyright (c) 2007 Mockito contributors * This program is made available under the terms of the MIT License. */ package org.mockito; import org.mockito.verification.VerificationMode; /** * 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");
*
*
* As of Mockito 1.8.4 you can verifyNoMoreInvocations() in order-sensitive way. Read more: {@link InOrder#verifyNoMoreInteractions()}
* * * See examples in javadoc for {@link Mockito} class */ public interface InOrder { /** * 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 {@link Mockito} class
*
* @param mock to be verified
*
* @return mock object itself
*/
* 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 {@link Mockito} class
*
* @param mock to be verified
* @param mode for example times(x) or atLeastOnce()
*
* @return mock object itself
*/
* Example: *
* mock.foo(); //1st
* mock.bar(); //2nd
* mock.baz(); //3rd
*
* InOrder inOrder = inOrder(mock);
*
* inOrder.verify(mock).bar(); //2n
* inOrder.verify(mock).baz(); //3rd (last method)
*
* //passes because there are no more interactions after last method:
* inOrder.verifyNoMoreInteractions();
*
* //however this fails because 1st method was not verified:
* Mockito.verifyNoMoreInteractions(mock);
*
*/
void verifyNoMoreInteractions();
}