mocking-with-mockito
CommunityMock like androidx with Mockito and Kotlin DSL
Software Engineering#mocking#mockito#matcher#argument-captor#mockito-kotlin#inline-mock-maker#jvm-unit-tests
Authorskydoves
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill solves the problem of setting up reliable Mockito-based mocking for Android JVM unit tests using the androidx-native Mockito stack and the mockito-kotlin DSL.
Core Features & Use Cases
- Mockito + mockito-kotlin wiring for JVM tests: Adds the correct dependency matrix for Mockito 5.x alongside the Kotlin DSL, covering
mock<T>(),whenever,argumentCaptor<T>(), and matcher ergonomics likeany(),anyOrNull(), andeq(). - Correct lifecycle and runner integration: Covers the three setup styles (
MockitoJUnit.rule(),MockitoAnnotations.openMocks(this), and Mockito JUnit5 extension) and avoids deprecatedinitMocks. - Practical handling of common mocking failures: Fixes issues like matcher mixing (
InvalidUseOfMatchersException), final-class mocking via inline mock-maker configuration, and suspend-stubbing ergonomics when usingrunTestorrunBlocking. - When NOT to use it: Directs users to mockk for coroutine-style mocking (
coEvery/coVerify) or to other skills for runner/coroutine setup decisions.
Quick Start
Use the mocking-with-mockito skill to configure Mockito 5.x with mockito-kotlin DSL in your JVM unit test and then stub and verify interactions using whenever, argumentCaptor<T>(), and Kotlin-safe matchers.
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-mockito Download link: https://github.com/skydoves/android-testing-skills/archive/main.zip#mocking-with-mockito 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.