commit | 7dcebc913be37a66392d634f3558bcb698413230 | [log] [tgz] |
---|---|---|
author | Niek Haarman <haarman.niek@gmail.com> | Fri Sep 09 12:21:27 2016 +0200 |
committer | Niek Haarman <haarman.niek@gmail.com> | Fri Sep 09 12:21:27 2016 +0200 |
tree | c58bddf5114a1d4bd6f14107269f19d53c19fe2b | |
parent | c029a131ca067001f3e971a4124aac8b1655c199 [diff] |
Stop. Sending me. Emails.
A small library that provides helper functions to work with Mockito in Kotlin.
Mockito-Kotlin is available on JCenter. For Gradle users, add the following to your build.gradle
:
repositories { jcenter() } 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 */ classUnderText.doAction() /* Then */ verify(mock).doSomething(any()) }
For more info and samples, see the Wiki.