commit | 76872e8807b4207d29036af2eeef615fbb2b336e | [log] [tgz] |
---|---|---|
author | Niek Haarman <haarman.niek@gmail.com> | Sat Jun 03 15:02:03 2017 +0200 |
committer | Niek Haarman <haarman.niek@gmail.com> | Sat Jun 03 15:02:03 2017 +0200 |
tree | a4925fdb707433726467f298065790cf1ce09f7d | |
parent | e0c147539283d1e3bb2b9d2c2c130b51f0164517 [diff] |
Make `same` return non-null type
A small library that provides helper functions to work with Mockito in Kotlin.
Mockito-Kotlin is available on Maven Central and JCenter. For Gradle users, add the following to your build.gradle
, replacing x.x.x
with the latest version:
testCompile "com.nhaarman:mockito-kotlin:x.x.x"
A test using Mockito-Kotlin typically looks like the following:
@Test fun doAction_doesSomething(){ /* Given */ val mock = mock<MyClass> { on { getText() } doReturn "text" } val classUnderTest = ClassUnderTest(mock) /* When */ classUnderTest.doAction() /* Then */ verify(mock).doSomething(any()) }
For more info and samples, see the Wiki.