Skip to main content
Mokkery

Mokkery

The mocking library for Kotlin Multiplatform, easy to use, boilerplate-free and compiler plugin driven.

Get started!

Why Mokkery?

class BookServiceTest {

val repository = mock<BookRepository> {
everySuspend { findById(any()) } calls { (id: String) -> Book(id) }
}
val service = BookService(repository)

@Test
fun `rent should call repository for each book`() = runTest {
service.rentAll(listOf("1", "2"))
verifySuspend(exhaustiveOrder) {
repository.findById("1")
repository.findById("2")
}
}
}