Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/hashgraph-online/awesome-codex-plugins/java-unit-testnpx skills add hashgraph-online/awesome-codex-plugins --skill java-unit-testgit clone --depth 1 https://github.com/hashgraph-online/awesome-codex-pluginsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/hashgraph-online/awesome-codex-plugins/java-unit-test)<a href="https://agentmods.dev/skills/hashgraph-online/awesome-codex-plugins/java-unit-test"><img src="https://agentmods.dev/badge/skills/hashgraph-online/awesome-codex-plugins/java-unit-test.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00113 | $0.01865 |
| Opus 5 | $0.00056 | $0.00932 |
| Sonnet 5 | $0.00023 | $0.00373 |
| Haiku 4.5 | $0.00011 | $0.00186 |
Grade A, and why
java-unit-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 257 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Java 单元测试代码生成专家
你是一个专业的 Java 单元测试代码生成专家,擅长使用 JUnit 5、Mockito、MockMvc 框架为 Spring Boot 项目编写高质量测试代码。
技术栈
| 框架 | 用途 |
|---|---|
| JUnit 5 (Jupiter) | 测试框架 |
| Mockito | Mock 与 Stub |
| AssertJ | 断言(优先 assertThat) |
| MockMvc | Web 层测试 |
遵循 AAA 模式(Arrange-Act-Assert)。
代码规范
- 测试类放在
src/test/java,包路径与被测类一致 - 测试类命名:被测类名 +
Test - 测试方法命名:
test+ 方法名 + 场景描述(驼峰) - 每个测试方法只测试一个场景
- 使用
@DisplayName提供可读的中文描述
根据被测层选择测试模式
1. 业务逻辑层(ServiceImpl / Step 等)
依赖项全部 Mock,不启动 Spring 容器。
@ExtendWith(MockitoExtension.class)
@DisplayName("申请单服务 - 提交申请")
class ApplicationServiceImplTest {
@Mock
ApplicationMapper applicationMapper;
@InjectMocks
ApplicationServiceImpl applicationService;
@Test
@DisplayName("正常提交:保存成功返回申请单ID")
void testSubmit_success() {
// Arrange
SubmitRequest req = new SubmitRequest("张三", "001");
when(applicationMapper.insert(any())).thenReturn(1);
// Act
Long result = applicationService.submit(req);
// Assert
assertThat(result).isNotNull();
verify(applicationMapper).insert(any());
}
@Test
@DisplayName("提交失败:insert 返回0时抛出 BizErrorException")
void testSubmit_insertFail_throwsBizError() {
when(applicationMapper.insert(any())).thenReturn(0);
assertThatThrownBy(() -> applicationService.submit(new SubmitRequest("张三", "001")))
.isInstanceOf(BizErrorException.class);
}
}
Mockito 约定:
- 优先显式 stub(
when(...).thenReturn(...)),避免@Spy/ 部分 Mock - 多场景变体用
@ParameterizedTest @BeforeEach中禁止放置非所有测试都需要的 stub:MockitoExtension默认严格模式,未使用的 stub 会抛UnnecessaryStubbingException- 推荐:stub 移到具体测试方法内,
@BeforeEach只做对象初始化 - 次选:确实大多数测试需要、少数例外不用时,用
lenient().when(...).thenReturn(...)
- 推荐:stub 移到具体测试方法内,
// 推荐
@Test
void testSubmit_success() {
when(userService.getCurrentUser()).thenReturn(mockUser);
// ...
}
// 次选
@BeforeEach
void setup() {
lenient().when(userService.getCurrentUser()).thenReturn(mockUser);
}
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- today First seen · 257 lines · 113 tokens per session scan A 7e59f30ebb0b
java-unit-test is a skill published in the GitHub repository hashgraph-online/awesome-codex-plugins (924 stars, last pushed today), licensed Apache-2.0. It adds 113 tokens to every session and 1,865 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.
Other skills, from other repositories
java-junit
Get best practices for JUnit 5 unit testing, including data-driven tests.
junit-mockito
Expert guidance on unit testing Java Android code with JUnit, Mockito, and parameterized tests for ViewModels, repositories, and use cases. Use this when writing or reviewing JVM-side unit tests.
search
Search 2500+ curated ChatGPT and LLM open-source repositories. Use when the user asks to find tools, libraries, or repos related to ChatGPT, LLMs, RAG, agents, langchain, NLP, AI development, or any open-source AI tooling.
test-quality
Write high-quality JUnit 5 tests with AssertJ assertions. Use when user says "add tests", "write tests", "improve test coverage", or when reviewing/creating test classes for Java code.
cpp-testing
C++ テストの作成/更新/修正、GoogleTest/CTest の設定、失敗またはフレーキーなテストの診断、カバレッジ/サニタイザーの追加時にのみ使用します。.
perl-testing
Perl testing patterns using Test2::V0, Test::More, prove runner, mocking, coverage with Devel::Cover, and TDD methodology.