
Generates mocks and fakes for testing, utilizing a Kotlin Symbol Processor. Features include helper usage and workaround installation, supporting efficient setup and verification in unit tests.
= MocKMP :icons: font :version: 2.0.0
A Kotlin/Multiplatform Kotlin Symbol Processor that generates Mocks & Fakes.
WARNING: Version 2.0 brings compatibility with Kotlin 2.0, but with breaking changes. If you used version 1.17, have a look at the https://kosi-libs.org/mockmp/2.0/migration/1to2.html[Migration Guide].
== Installation
plugins { kotlin("multiplatform") id("com.google.devtools.ksp") id("org.kodein.mock.mockmp") version "{version}" }
kotlin { // Your Koltin/Multiplatform configuration }
== Example
class MyTest : TestsWithMocks() { override fun setUpMocks() = mocker.injectMocks(this)
@Mock lateinit var view: View
@Fake lateinit var model: Model
val controller by withMocks { Controller(view = view, firstModel = model) }
@Test fun controllerTest() {
every { view.render(isAny()) } returns true
controller.start()
verify { view.render(model) }
}
== Read more
See https://kosi-libs.org/mockmp/[MocKMP Documentation].
== Supported by
image::https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg[JetBrains logo.,link=https://jb.gg/OpenSourceSupport]
= MocKMP :icons: font :version: 2.0.0
A Kotlin/Multiplatform Kotlin Symbol Processor that generates Mocks & Fakes.
WARNING: Version 2.0 brings compatibility with Kotlin 2.0, but with breaking changes. If you used version 1.17, have a look at the https://kosi-libs.org/mockmp/2.0/migration/1to2.html[Migration Guide].
== Installation
plugins { kotlin("multiplatform") id("com.google.devtools.ksp") id("org.kodein.mock.mockmp") version "{version}" }
kotlin { // Your Koltin/Multiplatform configuration }
== Example
class MyTest : TestsWithMocks() { override fun setUpMocks() = mocker.injectMocks(this)
@Mock lateinit var view: View
@Fake lateinit var model: Model
val controller by withMocks { Controller(view = view, firstModel = model) }
@Test fun controllerTest() {
every { view.render(isAny()) } returns true
controller.start()
verify { view.render(model) }
}
== Read more
See https://kosi-libs.org/mockmp/[MocKMP Documentation].
== Supported by
image::https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg[JetBrains logo.,link=https://jb.gg/OpenSourceSupport]