commit | 0b43d0b9b40122fa4286336db459068c2177560b | [log] [tgz] |
---|---|---|
author | Niek Haarman <haarman.niek@gmail.com> | Thu Oct 13 15:33:27 2016 +0200 |
committer | Niek Haarman <haarman.niek@gmail.com> | Thu Oct 13 15:33:27 2016 +0200 |
tree | a13450b2ceba2d662365163219860ed78d74c794 | |
parent | cd16b04af395447f82d438ec206838fc116fbb4e [diff] |
Use the java class' name to create an array instance
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 */ classUnderTest.doAction() /* Then */ verify(mock).doSomething(any()) }
For more info and samples, see the Wiki.