What problem does it solve?
This skill eliminates low-quality, non-repeatable, or incomplete Java unit tests by providing strict, actionable rules and ready-to-run JUnit 5 + Mockito test implementations that improve maintainability and coverage for Spring Boot codebases.
Core Features & Use Cases
- Strict mocking and isolation: mock only dependencies of the system under test; never mock the SUT methods or DTO/POJO objects; use @WebMvcTest for controllers and Mockito extensions for other layers.
- Robust assertions and patterns: unify numeric comparisons to avoid overload ambiguity, use ReflectionTestUtils for private field injection when necessary, and require @DisplayName on each test method.
- Coverage-driven test design: produce normal, error, and boundary cases for each non-static, non-private method with the goal of >80% line coverage and include all necessary imports and annotations so tests are self-contained and runnable.
- Typical use cases: adding controller/service tests for Spring Boot 2.1.x, improving flaky or incomplete tests, creating regression tests after refactors or bug fixes, and reviewing/enforcing test quality and conventions.
Quick Start
Generate JUnit 5 tests for the UserService in a Spring Boot 2.1.x project that mock only its dependencies, cover normal, exception, and boundary scenarios, and include all imports and annotations so the tests run immediately.