When to use this skill
Use this skill whenever the user wants to:
- Write Java/Kotlin unit tests and extensions with JUnit 4/5
- Use assertions, lifecycle, parameterization, and mocks (Mockito, etc.)
How to use this skill
- Use cases:@Test、@BeforeEach、@AfterEach;Assertions(assertEquals、assertThrows);@ParameterizedTest。
- Ecosystem: JUnit 5 + Mockito/AssertJ; Maven/Gradle dependencies and surefire configuration.
- Run: mvn test, gradle test; IDE run and coverage.
Best Practices
- Unit tests should be independent and repeatable; avoid dependency on order and external services.
- Use mocks to isolate dependencies; keep naming and structure clear.
- Balance coverage and speed; always run in CI.
Keywords
junit, JUnit 5, unit testing, Java, Kotlin