commit | 289f69c22006c146ff342b8c8d9d9f47337cd0e1 | [log] [tgz] |
---|---|---|
author | Niek Haarman <haarman.niek@gmail.com> | Wed Jun 19 20:08:28 2019 +0200 |
committer | Niek Haarman <haarman.niek@gmail.com> | Wed Jun 19 20:08:28 2019 +0200 |
tree | e6b36063329d1859b434d7fc0b418504eba093bb | |
parent | 5a303f67f56c1931fc851bcf2f73c9545a04887e [diff] | |
parent | 76198eab935700356643fd8b8d417aec9b09bee4 [diff] |
Merge branch '2.x' into checketts-2.x
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.