- Notifications
You must be signed in to change notification settings - Fork205
mockito/mockito-kotlin
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A small library that provides helper functions to work withMockito in Kotlin.
Mockito-Kotlin is available on Maven Central.For Gradle users, add the following to yourbuild.gradle, replacingx.x.x with the latest version:
testImplementation"org.mockito.kotlin:mockito-kotlin:x.x.x"A test using Mockito-Kotlin typically looks like the following:
@TestfundoAction_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 theWiki.
Mockito-Kotlin is built with Gradle.
./gradlew buildbuilds and tests the project./gradlew publishToMavenLocalinstalls the maven artifacts in your local repository./gradlew checkruns the test suite (See Testing below)
Mockito-Kotlin roughly follows SEMVER
Mockito-Kotlin's test suite is located in a separatetests module,to allow running the tests using several Kotlin versions whilst stillkeeping the base module at a recent version.
./gradlew checkruns the checks including tests.
Usually it is enough to test only using the default Kotlin versions;CI will test against multiple versions.If you want to test using a different Kotlin version locally,add the-PtestKotlinVersion=1.2.3 argument to the Gradle invocation while running the tests.
mockito-kotlin was created and developed bynhaarman@ after which the repository was integrated into the official Mockito GitHub organization.We would like to thank Niek for the original idea and extensive work plus support that went intomockito-kotlin.
About
Using Mockito with Kotlin
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.