A Kotlin/Multiplatform Kotlin Symbol Processor that generates Mocks & Fakes.
Built in collaboration with Deezer.
plugins {
kotlin("multiplatform")
id("org.kodein.mock.mockmp") version "1.17.0"
}
kotlin {
// Your Koltin/Multiplatform configuration
}
mockmp {
usesHelper = true
installWorkaround()
}
class MyTest : TestsWithMocks() {
override fun setUpMocks() = injectMocks(mocker) //(1)
@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.