tag | 7e265442c36ca6a8eaf14aa8021d1783b3266a58 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Tue Jun 10 09:44:55 2025 -0700 |
object | ba88f4eed1ce5d58858f6dcb2d456f03aae6647e |
Android 16.0.0 release 1
commit | ba88f4eed1ce5d58858f6dcb2d456f03aae6647e | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue Mar 18 18:12:11 2025 -0700 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue Mar 18 18:12:11 2025 -0700 |
tree | 7c2df5315daf377ab953c55e3e7fca1999841a82 | |
parent | 0a23e460ac28f191e37a987c5a2f2ff291cd48f7 [diff] | |
parent | e0d6d2d1352beec9d4456d4182b0a7ff67983532 [diff] |
Snap for 13235988 from e0d6d2d1352beec9d4456d4182b0a7ff67983532 to 25Q2-release Change-Id: I7ea21fb39507795f7312983143db5a144f0e851d
A small library that provides helper functions to work with Mockito in Kotlin.
Mockito-Kotlin is available on Maven Central. For Gradle users, add the following to your build.gradle
, replacing x.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:
@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.
Mockito-Kotlin is built with Gradle.
./gradlew build
builds and tests the project./gradlew publishToMavenLocal
installs the maven artifacts in your local repository./gradlew check
runs the test suite (See Testing below)Mockito-Kotlin roughly follows SEMVER
Mockito-Kotlin's test suite is located in a separate tests
module, to allow running the tests using several Kotlin versions whilst still keeping the base module at a recent version.
./gradlew check
runs 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, set an environment variable KOTLIN_VERSION
and run the tests.
mockito-kotlin
was created and developed by nhaarman@ 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 into mockito-kotlin
.