commit | 45e6ce9e8bc3fbdf2f082711d505eab787ae85b2 | [log] [tgz] |
---|---|---|
author | Niek Haarman <haarman.niek@gmail.com> | Sat Feb 11 18:48:43 2017 +0100 |
committer | Niek Haarman <haarman.niek@gmail.com> | Sat Feb 11 18:48:43 2017 +0100 |
tree | 92216256f32c5979827df1688a6f82937ccf7a34 | |
parent | 418d84e639b531759b9342b9d27b43ae54e3364a [diff] |
Add doAnswer to OngoingStubbing
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.