About junit
A skill for Java and Kotlin developers writing unit tests with JUnit 4 or 5. It covers assertions, test lifecycle, parameterized tests, mocks, and common build and run workflows.
Key features
- 01JUnit 4 and 5 test guidance
- 02Assertions and lifecycle hooks
- 03Parameterized tests
- 04Mockito and AssertJ usage
- 05Maven and Gradle execution
Use cases
- 01Creating Java or Kotlin unit tests
- 02Testing exceptions and parameter sets
- 03Running tests in IDEs or CI
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ full-stack-skills/ testing-skills --skill junitAfter installing, type/junitin Claude Code to confirm it loaded.
Bundled filesagents/openai.yamlLICENSE.txt
Details
From the project READMEWhen to use this skill
Use this skill whenever the user wants to:
- 用 JUnit 4/5 编写 Java/Kotlin 单元测试与扩展
- 使用断言、生命周期、参数化与 mock(Mockito 等)
How to use this skill
- 用例:@Test、@BeforeEach、@AfterEach;Assertions(assertEquals、assertThrows);@ParameterizedTest。
- 生态:JUnit 5 + Mockito/AssertJ;Maven/Gradle 依赖与 surefire 配置。
- 运行:mvn test、gradle test;IDE 运行与覆盖率。
Best Practices
- 单测独立、可重复;避免依赖顺序与外部服务。
- 用 mock 隔离依赖;命名与结构清晰。
- 覆盖率与速度平衡;CI 中必跑。
Keywords
junit, JUnit 5, 单元测试, Java, Kotlin
Comments
Markdown supported