Skip to content
coworkplugins

Claude skill

Java Unit Test

Java Unit Test is a Claude skill in the Skills plugin. Java 开发期测试(纯单元测试)助手——@Mock + @InjectMocks 或项目既有的 @TestConfiguration 轻量 mock 装配,AssertJ 断言,毫秒级,零外部基础设施 (不连真实 DB / 容器 / 中间件)。在编写、评审、补全、重构单元测试时使用 本技能,无论用户是否提到具体框架(unit test / JUnit / Mockito / 测试用例 /…

CommunityShips in SkillsDeveloper Tools

What it does

The description in the skill's SKILL.md, which Claude reads to decide when to use it:

Java 开发期测试(纯单元测试)助手——@Mock + @InjectMocks 或项目既有的 @TestConfiguration 轻量 mock 装配,AssertJ 断言,毫秒级,零外部基础设施 (不连真实 DB / 容器 / 中间件)。在编写、评审、补全、重构单元测试时使用 本技能,无论用户是否提到具体框架(unit test / JUnit / Mockito / 测试用例 / 怎么测 / 测哪些 / 写多少)。 次级触发信号——代码或 pom 中出现:spring-boot-starter-test、junit-jupiter、 @Test / @BeforeEach / @ParameterizedTest / @MethodSource、 assertEquals(new BigDecimal、BigDecimal 比金额、 assertThat / isEqualByComparingTo / assertThatThrownBy(AssertJ)、 @Mock / @InjectMocks / MockitoAnnotations.openMocks、spy( / mockStatic / MockedStatic / mockito-core、@MockBean / @MockitoBean 用于纯单测; 用户任务词或痛点出现:只写 happy path、补测试不知道写几个、@MockBean 用于纯单测、 测够了没 / 写到什么程度算够、mock 不到内部 new 的对象、异常断言断 RuntimeException。 核心默认:AssertJ 断言(金额用 isEqualByComparingTo / compareTo,不用 equals)、 一个方法四维度必检(正向/反向/边界/异常)、栈中立跟随项目既有(JUnit 4/5 均支持)。 接口级验证(接口通不通)不写测试、不属本技能范围。 不适用:切片 / 集成 / 冒烟 / E2E 测试(@SpringBootTest / @WebMvcTest / Testcontainers / REST Assured / WireMock)→ java-integration-test (明示或确认后激活);性能测试、前端测试。

The skill's instructions (about 295 words) cover:

  • 唯一判据:把被测代码改坏,这条测试会红吗
  • 一、mock 注入的,是被测代码真正用的那个实例吗
  • 二、断言比的,是你真正要保证的东西吗
  • 三、这条断言有任何可能失败吗
  • 断言库(项目取值)
  • 覆盖到什么程度算够
  • 与 java-integration-test 的边界
  • 版本与范围

How to use it

  1. Java Unit Test comes inside the Skills plugin, so you get it by installing that plugin, along with its 9 other skills. A plugin installs as one unit, with all its skills. The plugin's page has the install steps, and plugins are saved to your Claude account.
  2. Ask Claude for the task. When your request matches the skill's description, Claude loads it.
  3. To pick it yourself in Claude chat, type / or click + and choose java-unit-test. In Claude Code and Cowork, type:
    /baixuanzhu-skills:java-unit-test

Source

Plugin
Skills
SKILL.md
View on GitHub
Repo stars
4
Repo last pushed
Nov 3, 2026
Checked
Nov 16, 2026

More skills in Skills