Skip to content

Commit

Permalink
Merge pull request #127 from nhaarman/release-0.12.2
Browse files Browse the repository at this point in the history
Release 0.12.2
  • Loading branch information
nhaarman committed Nov 24, 2016
2 parents 72279be + 05a65ec commit 7fb4bd9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mockito-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repositories {
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "org.mockito:mockito-core:2.2.17"
compile "org.mockito:mockito-core:2.2.22"

/* Tests */
testCompile "junit:junit:4.12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fun ignoreStubs(vararg mocks: Any): Array<out Any> = Mockito.ignoreStubs(*mocks)
fun inOrder(vararg mocks: Any): InOrder = Mockito.inOrder(*mocks)!!
fun inOrder(vararg mocks: Any, evaluation: InOrder.() -> Unit) = Mockito.inOrder(*mocks).evaluation()

inline fun <reified T : Any> isA(): T? = Mockito.isA(T::class.java)
inline fun <reified T : Any> isA(): T = Mockito.isA(T::class.java) ?: createInstance<T>()
fun <T : Any> isNotNull(): T? = Mockito.isNotNull()
fun <T : Any> isNull(): T? = Mockito.isNull()

Expand Down
17 changes: 16 additions & 1 deletion mockito-kotlin/src/test/kotlin/test/MockitoTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -492,4 +492,19 @@ class MockitoTest : TestBase() {
/* Then */
expect(mock.genericMethod()).toBe(2)
}
}

@Test
fun isA_withNonNullableString() {
mock<Methods>().apply {
string("")
verify(this).string(isA<String>())
}
}
@Test
fun isA_withNullableString() {
mock<Methods>().apply {
nullableString("")
verify(this).nullableString(isA<String>())
}
}
}

0 comments on commit 7fb4bd9

Please sign in to comment.