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 Migration Guide. |
plugins {
kotlin("multiplatform")
id("com.google.devtools.ksp")
id("org.kodein.mock.mockmp") version "2.0.0"
}
kotlin {
// Your Koltin/Multiplatform configuration
}
mockmp {
onTest {
withHelper()
}
}
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) }
}
}
See MocKMP Documentation.