commit | 294c8cc0396565e87e5046326ef45d086ca4c094 | [log] [tgz] |
---|---|---|
author | Sola <dev@sola.love> | Sun Aug 26 14:46:00 2018 +0800 |
committer | Sola <dev@sola.love> | Fri Jan 04 11:19:57 2019 +0800 |
tree | d7b2cabd6a0b5c4a66e9aa1a09f9110887eaa65b | |
parent | efccc0b4b2b361e9428bf4aa59b064952005d97a [diff] |
provide InvocationOnMock instance for BDDMyOngoingStubbing#willAnswer Signed-off-by: Sola <dev@sola.love>
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:
testImplementation "com.nhaarman.mockitokotlin2: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.