commit | eb0b113539767b787922c172625fe2c92ada1ae1 | [log] [tgz] |
---|---|---|
author | Niek Haarman <haarman.niek@gmail.com> | Sat Feb 11 19:17:15 2017 +0100 |
committer | GitHub <noreply@github.com> | Sat Feb 11 19:17:15 2017 +0100 |
tree | 92216256f32c5979827df1688a6f82937ccf7a34 | |
parent | 418d84e639b531759b9342b9d27b43ae54e3364a [diff] | |
parent | 45e6ce9e8bc3fbdf2f082711d505eab787ae85b2 [diff] |
Merge pull request #152 from nhaarman/mockstubbing-doanswer 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.