Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Java Testing?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/karthikrshet-java-testing)
---
name: java-testing
description: "Write and fix tests in Java with JUnit 5: use JUnit 5 with AssertJ, mocking at boundaries, async tests and CI settings."
tags: [java, testing]
---
# Java Testing
## When to use
- Writing or reviewing Java with JUnit 5 tests
- Setting up a test suite
- Fixing slow or flaky tests
## Procedure
1. Use JUnit 5 with AssertJ
2. Parameterized tests for cases
3. Mockito only at boundaries
4. Testcontainers for databases and brokers
5. Spring test slices (@WebMvcTest, @DataJpaTest) instead of full context
## Checklist
- [ ] Tests independent of order
- [ ] Context caching not broken by @DirtiesContext
## Anti-patterns
- Loading the full Spring context for unit tests
- Mocking the class under test