commit | 4779b29d3fe670e82f358eec8e8daf12e95d8004 | [log] [tgz] |
---|---|---|
author | Niek Haarman <haarman.niek@gmail.com> | Fri Jul 05 14:40:26 2019 +0200 |
committer | Niek Haarman <haarman.niek@gmail.com> | Fri Jul 05 14:40:26 2019 +0200 |
tree | 3630af139165fe926843e11af2b582876885cbbc | |
parent | b850ab164452a852ec43eb7e720216439554d7a7 [diff] | |
parent | 77bfcdda539668f1e7c0068cb47b43e71661d7a6 [diff] |
Merge branch 'checketts-2.x' into 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.