commit | e0d2b0d15dbd93da8e2c47b75a5effac88bd8693 | [log] [tgz] |
---|---|---|
author | Niek Haarman <haarman.niek@gmail.com> | Sun Dec 03 22:11:45 2017 +0100 |
committer | Niek Haarman <haarman.niek@gmail.com> | Sun Dec 03 22:12:38 2017 +0100 |
tree | 5541b4a2a1b1eae28379f5f9b6b539101be6a2ff | |
parent | 3bae5f137f90f1caebdc08d6797f2a0586219dd1 [diff] |
Accept any `Answer<*>` in `OngoingStubbing<T>.doAnswer`
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.