commit | 59eb1999a5b1f1d452674e99db8be8f91ee41f4b | [log] [tgz] |
---|---|---|
author | P.J.Meisch <pj.meisch@sothawo.com> | Sun Aug 26 11:11:34 2018 +0200 |
committer | P.J.Meisch <pj.meisch@sothawo.com> | Sun Aug 26 11:11:34 2018 +0200 |
tree | ff7c07ca12e96242a799e164763ffaf4a2bdc762 | |
parent | a0f787528b665c3c58945c9f54eeda5be546a9b4 [diff] |
add argThat(ArgumentMatcher<T>) function
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.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.