mockito
Use when generating mocks, stubbing methods, verifying interactions, capturing arguments, or choosing between mocks, fakes, and real objects (Mockito).
Install / Use
npx skills add evanca/flutter-ai-rules --skill mockitoInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Tags
Our assessment of mockito
mockito scores 88/100 on our quality scale, 1813th of 4,717 Development & Engineering skills we index (top 39%).
Its SKILL.md is 3.5 KB long, well organised into 11 sections with 10 code examples: a solid amount of guidance for an agent.
It has 670 GitHub stars, a meaningful sign that others use it.
Maintenance, license and trust
- The repository was last updated 13 days ago, so mockito is actively maintained.
- Our last check on 2026-10-31 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-10-04. Automated pattern scan on 2026-10-04. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
mockito compared with similar skills
All 4 of these similar skills score higher than mockito; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| mockito (this skill)by evanca | 88 | 670 | 13d ago | SKILL.md |
| taste-skillby Leonxlnx | 100 | 118.3k | 10d ago | CLAUDE.md |
| hyperframesby heygen-com | 100 | 86.4k | today | CLAUDE.md |
| ai-job-searchby ai-job-search-dev | 100 | 72.4k | today | CLAUDE.md |
| claude-howtoby luongnv89 | 100 | 47.4k | 4d ago | CLAUDE.md |
Frequently asked questions
- How do I install mockito?
- Run
npx skills add evanca/flutter-ai-rules --skill mockito. The install tabs above show the steps for each supported agent. - Which AI agents does mockito work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is mockito safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is mockito still maintained?
- The repository was last updated 13 days ago, so mockito is actively maintained.
Skill content
View source on GitHubname: mockito description: "Use when generating mocks, stubbing methods, verifying interactions, capturing arguments, or choosing between mocks, fakes, and real objects (Mockito)." license: MIT
Mockito Skill
This skill defines how to correctly use the mockito package for mocking in Dart and Flutter tests.
1. Mock vs. Fake vs. Real Object
| Use | When |
|---|---|
| Real object | Prefer over mocks when practical. |
| Fake (extends Fake) | Lightweight custom implementation; override only the methods you need. Prefer over mocks when you don't need interaction verification. |
| Mock (extends Mock) | Only when you need to verify interactions (call counts, arguments) or stub dynamic responses. |
- Data models should not be mocked if they can be constructed with stubbed data.
- Only use mocks if your test has
verifyassertions; otherwise prefer real or fake objects.
2. Generating Mocks
@GenerateMocks([MyClass])
// or for nice mocks (return simple legal values for missing stubs):
@GenerateNiceMocks([MockSpec<MyClass>()])
void main() { ... }
dart run build_runner build
- Only annotate files under
test/for mock generation by default. - Use a
build.yamlif you need to generate mocks outside oftest/. - Never add
@overridemethods or implementations to a class extendingMock. - Never stub responses in a mock's constructor or inside the mock class — always stub in your tests.
3. Stubbing
final mock = MockCat();
// Return a value
when(mock.sound()).thenReturn('Meow');
// Throw an error
when(mock.sound()).thenThrow(Exception('No sound'));
// Calculate response at call time
when(mock.sound()).thenAnswer((_) => computedValue);
// Return values in sequence
when(mock.sound()).thenReturnInOrder(['Meow', 'Purr']);
- Always stub methods/getters before using them if you need specific return values.
- Missing stub behavior:
@GenerateMocks→ throws;@GenerateNiceMocks→ returns a simple legal value. - Use
throwOnMissingStub(mock)to throw on any unstubbed call.
4. Verification
verify(mock.sound()); // called at least once
verifyNever(mock.eat(any)); // never called
verify(mock.sound()).called(2); // called exactly twice
Async:
await untilCalled(mock.sound()); // wait for the interaction
5. Argument Matchers
// Flexible stubbing
when(mock.eat(any)).thenReturn(true);
when(mock.eat(argThat(isNotNull))).thenReturn(true);
// Named arguments
when(mock.fetch(any, headers: any)).thenReturn(response);
- Do not use
nullas an argument adjacent to an argument matcher. - For named arguments, use
anyorargThatas values, not as argument names.
6. Capturing Arguments
final captured = verify(mock.eat(captureAny)).captured;
print(captured.last); // last captured argument
Use captureThat for conditional capturing.
7. Resetting Mocks
reset(mock); // clear all stubs AND interactions
clearInteractions(mock); // clear only recorded interactions
8. Mocking Function Types
To mock a function type (e.g., a callback), define an abstract class with the required signature and generate mocks for it:
abstract class Callback {
void call(String value);
}
@GenerateMocks([Callback])
9. Debugging
logInvocations([mock1, mock2]); // print all collected invocations
References
Related Skills
taste-skill
118.3kAgent skills that give coding agents taste: art direction, reference images and a browser check instead of generic AI pages
hyperframes
86.4kAI video you can actually edit. HyperFrames is a free, open-source AI video editor. Describe any video and get a real project you can change down to the frame.
ai-job-search
72.4kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
claude-howto
47.4kA visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
