testing

Standardize Mockito service unit tests and @WebMvcTest controller tests for Java projects.

10|1|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/andresdiegolanda/design-first-ai --skill testing-andresdiegolanda
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/andresdiegolanda/design-first-ai/tree/main/context/skills/testing
Command: npx skills add https://github.com/andresdiegolanda/design-first-ai --skill testing-andresdiegolanda

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Consistent testing requires disciplined structure and naming for service-level unit tests and controller-level integration tests, preventing ad-hoc coverage gaps.

Core Features & Use Cases

  • Standardizes unit tests for service layer using Mockito with no Spring context, enabling fast, deterministic tests.
  • Provides controller tests using @WebMvcTest with MockMvc and mocked services for isolated verification.
  • Enforces a clear naming convention and test structure to improve maintainability and readability.

Quick Start

Guide your AI to scaffold Mockito-based service tests and WebMvcTest controller tests for a new feature.

Frequently Asked Questions about testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize unit tests for Java service and controller layers?

Standardize Java unit tests by applying Mockito for service layers and @WebMvcTest for controllers, enforcing a consistent naming convention and test structure without requiring a Spring context for services.

What is the best way to test Spring Web MVC controllers in isolation?

Test Spring Web MVC controllers in isolation using @WebMvcTest with MockMvc and mocked services, verifying web layer behavior without loading the full application context.

Do I need a Spring context to run Mockito unit tests for the service layer?

No, you do not need a Spring context to run Mockito unit tests for the service layer, enabling fast and deterministic testing by directly mocking dependencies.

How does enforcing a naming convention improve Java unit test maintainability?

Enforcing a naming convention improves Java unit test maintainability by standardizing test structure and readability, preventing ad-hoc coverage gaps across service and controller layers.

Can I use this testing approach for both integration-style and pure unit tests?

Yes, you can use this approach for both integration-style controller tests and pure unit tests by combining @WebMvcTest for web layers and Mockito for isolated service testing.