java-testing
Test Java applications - JUnit 5, Mockito, integration testing, TDD patterns
By pluginagentmarketplace · 856 installs
npx skills add pluginagentmarketplace/custom-plugin-java --skill java-testing
Source repository · Upstream listing
Java Testing Skill
Write comprehensive tests for Java applications with modern testing practices.
Overview
This skill covers Java testing with JUnit 5, Mockito, AssertJ, and integration testing with Spring Boot Test and Testcontainers. Includes TDD patterns and test coverage strategies.
When to Use This Skill
Use when you need to:
Write unit tests with JUnit 5
Create mocks with Mockito
Build integration tests with Testcontainers
Implement TDD/BDD practices
Improve test coverage
Topics Covered
JUnit 5
@Test, @Nested, @DisplayName
@ParameterizedTest with sources
Lifecycle annotations
Extensions and custom annotations
Mockito
@Mock, @InjectMocks, @Spy
Stubbing (when/thenReturn)
Verification (verify, times)
BDD style (given/willReturn)
AssertJ
Fluent assertions
Collection assertions
Exception assertions
Custom assertions
Integration Testing
@SpringBootTest slices
Testcontainers setup
MockMvc for APIs
Database testing
Quick Reference
Test Data Builders
Coverage Goals
Troubleshooting
Common Issues
Problem Cause Solution
Mock not working Missing @ExtendWith Add MockitoExtension
NPE in test Mock not initialized Check @InjectMocks
Flaky test Shared state Isolate test data
Context fails Missing bean Use @MockBean
Debug Checklist
Usage
Related Skills
java testing advanced Advanced patterns
java spring boot Spring test slices