Skip to content

Commit 7fb4bd9

Browse files
authored
Merge pull request #127 from nhaarman/release-0.12.2
Release 0.12.2
2 parents 72279be + 05a65ec commit 7fb4bd9

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

mockito-kotlin/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ repositories {
2626
dependencies {
2727
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
2828
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
29-
compile "org.mockito:mockito-core:2.2.17"
29+
compile "org.mockito:mockito-core:2.2.22"
3030

3131
/* Tests */
3232
testCompile "junit:junit:4.12"

mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/Mockito.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fun ignoreStubs(vararg mocks: Any): Array<out Any> = Mockito.ignoreStubs(*mocks)
7878
fun inOrder(vararg mocks: Any): InOrder = Mockito.inOrder(*mocks)!!
7979
fun inOrder(vararg mocks: Any, evaluation: InOrder.() -> Unit) = Mockito.inOrder(*mocks).evaluation()
8080

81-
inline fun <reified T : Any> isA(): T? = Mockito.isA(T::class.java)
81+
inline fun <reified T : Any> isA(): T = Mockito.isA(T::class.java) ?: createInstance<T>()
8282
fun <T : Any> isNotNull(): T? = Mockito.isNotNull()
8383
fun <T : Any> isNull(): T? = Mockito.isNull()
8484

mockito-kotlin/src/test/kotlin/test/MockitoTest.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,4 +492,19 @@ class MockitoTest : TestBase() {
492492
/* Then */
493493
expect(mock.genericMethod()).toBe(2)
494494
}
495-
}
495+
496+
@Test
497+
fun isA_withNonNullableString() {
498+
mock<Methods>().apply {
499+
string("")
500+
verify(this).string(isA<String>())
501+
}
502+
}
503+
@Test
504+
fun isA_withNullableString() {
505+
mock<Methods>().apply {
506+
nullableString("")
507+
verify(this).nullableString(isA<String>())
508+
}
509+
}
510+
}

0 commit comments

Comments
 (0)