commit | a734cde5f34102f9bb5bda1aca8a7d3f69af1b1c | [log] [tgz] |
---|---|---|
author | Niek Haarman <haarman.niek@gmail.com> | Thu Nov 24 13:22:34 2016 +0100 |
committer | Niek Haarman <haarman.niek@gmail.com> | Thu Nov 24 13:22:34 2016 +0100 |
tree | 82b3259dd5157e4b943b94bae3bea07d2877be0b | |
parent | 7fb4bd9ff100f88d5d621d5726b374b55c30468f [diff] |
Test with Kotlin 1.1-M03
A small library that provides helper functions to work with Mockito in Kotlin.
Mockito-Kotlin is available on Maven Central. For Gradle users, add the following to your build.gradle
, replacing x.x.x
with the latest version:
repositories { mavenCentral() } dependencies { testCompile "com.nhaarman:mockito-kotlin:x.x.x" }
A test using Mockito-Kotlin typically looks like the following:
@Test fun a(){ /* 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.