Skip to content

kosi-libs/MocKMP

Repository files navigation

MocKMP

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.

Installation

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() } }

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

Supported by

JetBrains logo.

About

A mocking processor for Kotlin Multiplatform

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages