mocking-with-mockk
CommunityMock coroutines and Kotlin objects cleanly
Authorskydoves
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill helps you reliably mock Kotlin collaborators in JVM unit tests when suspend functions, coroutines, and Kotlin object/singletons are involved, so your tests can verify interactions without brittle workarounds.
Core Features & Use Cases
- Suspend-safe stubbing and verification: Use
coEvery { ... } returns ...andcoVerify { ... }to avoidrunBlocking-style wrappers and to prevent Continuation-matching errors. - Kotlin-native mocking coverage: Mock Kotlin
object/singleton behavior (mockkObject), statics (mockkStatic), and constructors (mockkConstructor) with proper cleanup. - Strict interaction testing with argument capture: Capture arguments via
slot<T>(), enforce call ordering usingverifySequence/verifyOrder, and guard against unexpected calls usingconfirmVerified.
Quick Start
Tell the AI to generate a JVM unit-test setup that uses MockK to stub a suspend repository method with coEvery, verify it with coVerify, capture a saved entity with slot, and include unmockkAll() teardown when any static/object/constructor mocking is used.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: mocking-with-mockk Download link: https://github.com/skydoves/android-testing-skills/archive/main.zip#mocking-with-mockk Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.