Preface¶
Once your codebase accumulates a large number of business classes, writing or supplementing unit tests tends to fall into a few common traps: covering only the happy path, testing just one or two branch conditions, validating only the normal flow of state transitions, or bolting @MockBean onto a test that should be a pure unit test just to make it run locally—spinning up the Spring Context in the process. The latter approach is slow and defeats the very purpose of “isolating the class under test.” What follows is an introduction to Java Development-time Testing on SkillHub, which pins the scope strictly to pure unit testing: Mockito’s @Mock / @InjectMocks, millisecond-level execution, zero containers—and provides a consistent set of evaluation dimensions and boundary guidelines for writing, reviewing, supplementing, and refactoring tests.
What Is This¶
Java Development-time Testing is a community-published Agent Skill (coordinate @user_a36dc51e/java-unit-test, current version 2.0.0), categorized under dev-programming, and maintained by the publisher user_a36dc51e. The Skill describes its rules and default behaviors in a SKILL.md file, which assistants such as Cursor (or any other Skill-compatible agent) can follow automatically or on demand during a conversation.
It addresses the following question: how to systematically write, review, and supplement pure unit tests in a Java project—including which paths to cover, how much to write, which assertion stack to use, and which scenarios should be delegated to another Skill.
Core Features¶
The capabilities below are drawn from the Skill’s official description and can be cross-referenced with the SkillHub page.
Pure Unit Test Boundaries¶
- Default approach:
@Mock+@InjectMocks; execution completes in milliseconds with no Spring Context, no containers, zero infrastructure. - Does not cover “does the interface respond” type of verification; that is outside the scope of this Skill.
- When tests require real dependency assertions, repeatable regression, or heavyweight setups (e.g., Testcontainers, E2E), use java-integration-test instead (either explicitly requested or confirmed by the assistant before switching).
Four-Dimension Checklist¶
For every method under test, the default expectation is that all four dimensions are considered: positive, negative, boundary, and exception. This checklist answers questions like “Is coverage sufficient?” and “How thorough is enough?” and supports filling in missing test cases.
Tech Stack & Assertions¶
- Default assertion library: JUnit 5 native assertions (e.g.,
assertEquals,assertThrows). - Stack-agnostic: follows the project’s existing stack; both JUnit 4 and JUnit 5 are supported. If the project already uses AssertJ (
assertThat,extracting, etc.), the project convention takes precedence. - Mockito-related: the presence of
MockitoAnnotations.openMocks,mockStatic/MockedStatic,mockito-core, etc. in code orpomfiles serves as a secondary trigger signal.
Test Case Design Signals¶
When the conversation or code reveals the following pain points, the Skill shifts focus toward test case design rather than simply stacking up duplicate @Test methods:
- Only the happy path is tested; unclear how many tests to write; multi-condition branches tested with only one or two conditions.
- Stateful objects tested only along the normal transition path.
- Misuse of
@MockBean/@MockitoBeanfor what should be an isolated pure unit test. - Mention of design techniques such as equivalence classes, boundary values, decision tables, or state transitions.
Secondary Triggers (Code & Dependencies)¶
Beyond natural-language cues (unit test, JUnit, Mockito, test case, how to test, etc.), the presence of artifacts such as spring-boot-starter-test, junit-jupiter, @Test / @BeforeEach / @ParameterizedTest / @MethodSource in the pom or source code also strengthens the association with this Skill.
Explicitly Out of Scope¶
The following should be handled by java-integration-test rather than this Skill:
- Slice / integration / smoke / E2E tests: full-context
@SpringBootTest,@WebMvcTest, Testcontainers, REST Assured, WireMock, etc. - Performance testing, frontend testing.
Installation & Activation¶
The verified metadata is as follows (requires_api_key=false; no API key needed):
| Field | Value |
|---|---|
| Coordinate | @user_a36dc51e/java-unit-test |
| Version | 2.0.0 |
| Source | community |
| Category | dev-programming |
Open the skill page on the SkillHub site and follow the platform’s Skills installation flow to load the coordinate above into your current Agent environment:
Skill page: https://www.skillhub.cn/skills/user_a36dc51e/java-unit-test
API base URL: https://api.skillhub.cn/user_a36dc51e/java-unit-test
Coordinate: @user_a36dc51e/java-unit-test
For specific installation sub-commands in each product (Cursor, Codex CLI, Claude Code, etc.), refer to the current SkillHub documentation; CLI differences not documented on the official page are not elaborated here.
Once activated, simply describe your requirements in any conversation about writing, reviewing, supplementing, or refactoring unit tests; there is no need to repeat the full Skill name every time. However, if the project’s dependencies and pain points align with the trigger signals described above, the assistant is more likely to automatically align with this Skill’s default rules.
Typical Usage¶
This Skill does not replace your local test runner; rather, it constrains how the assistant produces and reviews test output. Typical workflows are as follows.
- Creating or supplementing a test class: Provide the class and methods under test, and describe the existing coverage gaps (e.g., “only positive cases exist”). The assistant should enumerate or generate test cases across all four dimensions, preferring
@Mockfor dependencies and@InjectMocksfor the class under test, and avoiding Spring context startup. - Reviewing existing tests: Paste a test class or have the assistant read test files in the workspace, and ask “Is this sufficient?” or “Is there misuse of integration-level techniques?” The Skill will distinguish pure unit test scenarios from those that should be handed off to java-integration-test.
- Parameterized tests vs. repetitive
@Test: When dealing with multiple branches or boundaries, the assistant is guided to use@ParameterizedTest,@MethodSource, etc. (respecting the project’s existing JUnit version), reducing hand-written duplicate methods. - Static methods or utility classes: When
mockStatic/MockedStaticappears in the code, tests are organized following Mockito conventions while still avoiding container introduction.
To reproduce, simply ensure: the project’s pom or module already has JUnit / Mockito (or test dependencies from spring-boot-starter-test), and the conversation task falls within the unit test scope.
Applicable Scenarios & Caveats¶
Who It’s For
- Spring Boot or plain Java modules where Service, Domain, or utility methods need fast, locally repeatable unit tests.
- Teams that want a unified standard of “at least think through positive / negative / boundary / exception for every method,” rather than each reviewer having a different opinion.
- Teams that want the assistant to default to JUnit 5 assertions while still maintaining JUnit 4 compatibility in legacy projects.
Caveats
- Do not use this Skill to generate
@SpringBootTest,@WebMvcTest, Testcontainers, or similar solutions; switch to java-integration-test and state your intent explicitly when needed. - “Can the interface be called successfully” and cross-process E2E are out of scope; avoid stuffing integration acceptance criteria into a test that is meant to be a lightweight unit test.
- SkillHub stats (as of the page snapshot): rating 100000, 802 downloads; the install count is a platform display field—refer to the live SkillHub page for current numbers.
Closing¶
Java Development-time Testing narrows the Agent assistant’s default behavior to pure unit testing: Mock-based isolation, four-dimension checks, JUnit stack-agnosticism—and explicitly externalizes integration and E2E concerns to java-integration-test. During the development cycle, when writing, supplementing, or modifying tests, you can attach this Skill directly to reduce scope drift.
Official entry points:
- https://www.skillhub.cn/skills/user_a36dc51e/java-unit-test
- https://api.skillhub.cn/user_a36dc51e/java-unit-test