File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
main/kotlin/com/nhaarman/mockito_kotlin Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ inline fun <reified T : Any> any() = Mockito.any(T::class.java) ?: createInstanc
43
43
inline fun <reified T : Any ? > anyArray (): Array <T > = Mockito .any(Array <T >::class .java) ? : arrayOf()
44
44
inline fun <reified T : Any > anyVararg (): T = Mockito .any<T >() ? : createInstance<T >()
45
45
inline fun <reified T : Any > argThat (noinline predicate : T .() -> Boolean ) = Mockito .argThat<T > { it -> (it as T ).predicate() } ? : createInstance(T ::class )
46
+ inline fun <reified T : Any > argForWhich (noinline predicate : T .() -> Boolean ) = argThat(predicate)
46
47
47
48
fun atLeast (numInvocations : Int ): VerificationMode = Mockito .atLeast(numInvocations)!!
48
49
fun atLeastOnce (): VerificationMode = Mockito .atLeastOnce()!!
Original file line number Diff line number Diff line change @@ -133,6 +133,15 @@ class MockitoTest {
133
133
})
134
134
}
135
135
}
136
+ @Test
137
+ fun listArgForWhich () {
138
+ mock<Methods >().apply {
139
+ closedList(listOf (Closed (), Closed ()))
140
+ verify(this ).closedList(argForWhich {
141
+ size == 2
142
+ })
143
+ }
144
+ }
136
145
137
146
@Test
138
147
fun atLeastXInvocations () {
You can’t perform that action at this time.
0 commit comments