File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
main/kotlin/com/nhaarman/mockito_kotlin Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ fun doThrow(vararg toBeThrown: Throwable): Stubber = Mockito.doThrow(*toBeThrown
7676fun <T > eq (value : T ): T = Mockito .eq(value) ? : value
7777fun ignoreStubs (vararg mocks : Any ): Array <out Any > = Mockito .ignoreStubs(* mocks)!!
7878fun inOrder (vararg mocks : Any ): InOrder = Mockito .inOrder(* mocks)!!
79+ fun inOrder (vararg mocks : Any , evaluation : InOrder .() -> Unit ) = Mockito .inOrder(* mocks).evaluation()
7980
8081inline fun <reified T : Any > isA (): T ? = Mockito .isA(T ::class .java)
8182fun <T : Any > isNotNull (): T ? = Mockito .isNotNull()
Original file line number Diff line number Diff line change 11package test
2+
23import com.nhaarman.expect.expect
34import com.nhaarman.expect.expectErrorWithMessage
45import com.nhaarman.expect.fail
@@ -177,6 +178,23 @@ class MockitoTest : TestBase() {
177178 }
178179 }
179180
181+ @Test
182+ fun testInOrderWithLambda () {
183+ /* Given */
184+ val a = mock< () -> Unit > ()
185+ val b = mock< () -> Unit > ()
186+
187+ /* When */
188+ b()
189+ a()
190+
191+ /* Then */
192+ inOrder(a, b) {
193+ verify(b).invoke()
194+ verify(a).invoke()
195+ }
196+ }
197+
180198 @Test
181199 fun testClearInvocations () {
182200 val mock = mock<Methods >().apply {
You can’t perform that action at this time.
0 commit comments