Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kosi-libs/MocKMP

A mocking processor for Kotlin Multiplatform
https://github.com/kosi-libs/MocKMP

Last synced: 6 days ago
JSON representation

A mocking processor for Kotlin Multiplatform

Awesome Lists containing this project

README

        

= MocKMP
:icons: font
:version: 1.17.0

A Kotlin/Multiplatform Kotlin Symbol Processor that generates Mocks & Fakes.

Built in collaboration with https://www.deezer.com/[Deezer].

== Installation

[source,kotlin,subs="verbatim,attributes"]
----
plugins {
kotlin("multiplatform")
id("org.kodein.mock.mockmp") version "{version}"
}

kotlin {
// Your Koltin/Multiplatform configuration
}

mockmp {
usesHelper = true
installWorkaround()
}
----

== Example

[source,kotlin]
----
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) }
}
}
----

== Read more

See https://kosi-libs.org/mockmp/[MocKMP Documentation].