spring-testing-fundamentals
Boot 4 renamed @MockBean to @MockitoBean, moved test slice annotations to new packages, and changed context caching behavior. Read for correct AssertJ/BDDMockito idioms and Boot 4 migration. Default fallback when no specific slice annotation is present. Triggers: assertThat, BDDMockito, ArgumentCaptor, @MockitoBean, @MockitoSpyBean, @DirtiesContext, UnnecessaryStubbingException, testing pyramid, context cache.
How do I install this agent skill?
npx skills add https://github.com/spring-ai-community/spring-testing-skills --skill spring-testing-fundamentalsIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides safe and technically accurate documentation for Spring Boot testing fundamentals, AssertJ idioms, and migration paths for Spring Boot 4.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
- Runlayerpass
1/3 files flagged
What does this agent skill do?
Spring Testing Fundamentals
Signals: assertThat, assertThatThrownBy, given/willReturn, then(mock).should, ArgumentCaptor, @MockitoBean, @MockitoSpyBean, @DirtiesContext, context caching, testing pyramid
Tested With
- Spring Boot 3.2+ / Spring Boot 4.x
- Spring Framework 6.x / Spring Framework 7.x
- AssertJ 3.24+
- Mockito 5.x
- JUnit 5
Do NOT Use This Skill When
You need domain-specific patterns:
- Testing JPA repositories, Testcontainers,
@DataJpaTest→ usespring-jpa-testing - Testing REST controllers, MockMvc,
@WebMvcTest→ usespring-mvc-testing - Testing security,
@WithMockUser, JWT, OAuth2 → usespring-security-testing - Testing reactive controllers,
@WebFluxTest,StepVerifier→ usespring-webflux-testing - Testing WebSocket/STOMP → use
spring-websocket-testing
When to Read References
| Situation | Read |
|---|---|
| AssertJ scalars, optionals, BigDecimal, collections, exceptions | references/assertj-mockito-idioms.md |
BDDMockito given/willReturn, then(mock).should, argument matchers | references/assertj-mockito-idioms.md |
ArgumentCaptor usage and verification patterns | references/assertj-mockito-idioms.md |
UnnecessaryStubbingException and strict stubbing fixes | references/assertj-mockito-idioms.md |
@MockitoBean vs @MockitoSpyBean in Boot 4 | references/assertj-mockito-idioms.md |
| Testing pyramid: when to use each slice annotation | references/cross-cutting-testing-patterns.md |
Context caching: why tests are slow, cache key, @DirtiesContext impact | references/cross-cutting-testing-patterns.md |
| Universal anti-patterns across all Spring test types | references/cross-cutting-testing-patterns.md |
| Boot 4 annotation migration checklist | references/cross-cutting-testing-patterns.md |
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/spring-ai-community/spring-testing-skills/spring-testing-fundamentals">View spring-testing-fundamentals on skillZs</a>