mcpField
J
junit

junit

github.com/full-stack-skillsTesting & quality266 installsUpdated 4w ago
Repository

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

  1. 01JUnit 4 and 5 test guidance
  2. 02Assertions and lifecycle hooks
  3. 03Parameterized tests
  4. 04Mockito and AssertJ usage
  5. 05Maven and Gradle execution

Use cases

  1. 01Creating Java or Kotlin unit tests
  2. 02Testing exceptions and parameter sets
  3. 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 junit

After installing, type/junitin Claude Code to confirm it loaded.

Bundled filesagents/openai.yamlLICENSE.txt

Details

From the project README

When to use this skill

Use this skill whenever the user wants to:

  • 用 JUnit 4/5 编写 Java/Kotlin 单元测试与扩展
  • 使用断言、生命周期、参数化与 mock(Mockito 等)

How to use this skill

  1. 用例:@Test、@BeforeEach、@AfterEach;Assertions(assertEquals、assertThrows);@ParameterizedTest。
  2. 生态:JUnit 5 + Mockito/AssertJ;Maven/Gradle 依赖与 surefire 配置。
  3. 运行:mvn test、gradle test;IDE 运行与覆盖率。

Best Practices

  • 单测独立、可重复;避免依赖顺序与外部服务。
  • 用 mock 隔离依赖;命名与结构清晰。
  • 覆盖率与速度平衡;CI 中必跑。

Keywords

junit, JUnit 5, 单元测试, Java, Kotlin

Comments

Markdown supported