java-unit-test

java-unit-test is an agent for Claude Code from ProjAnvil/MindForge. It costs 33 tokens per session (771 once invoked), scanned A, original, MIT.

A Java unit-testing assistant that creates tests with tools such as JUnit, Mockito, and AssertJ. Unit tests check one small part of a program in isolation from the rest.

In plain words
What is it for?
Use it to generate and organize Java unit tests, including mocked dependencies, Arrange-Act-Assert sections, naming conventions, and coverage strategies.
Why use it?
It helps cover normal cases, edge cases, errors, asynchronous code, and other behaviors without writing each test structure from scratch.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

Part of the mindforge-en plugin — 19 skills, 9 agents shipped together

Good fit Use it to generate and organize Java unit tests, including mocked dependencies, Arrange-Act-Assert sections, naming conventions, and coverage strategies.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/projanvil/mindforge/java-unit-test
Install

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.

Clone the repo
git clone --depth 1 https://github.com/ProjAnvil/MindForge

Made for: Claude Code.

Or install mindforge-en, the plugin that ships this one along with the rest of its 19 skills, 9 agents.

Wrote 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.

agentmods badge for java-unit-test

README.md
[![agentmods](https://agentmods.dev/badge/agents/projanvil/mindforge/java-unit-test/github.svg)](https://agentmods.dev/agents/projanvil/mindforge/java-unit-test)
Your own site
<a href="https://agentmods.dev/agents/projanvil/mindforge/java-unit-test"><img src="https://agentmods.dev/badge/agents/projanvil/mindforge/java-unit-test/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for java-unit-test

Your own site · 80×15
<a href="https://agentmods.dev/agents/projanvil/mindforge/java-unit-test"><img src="https://agentmods.dev/badge/agents/projanvil/mindforge/java-unit-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 33 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 771 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00033 $0.00771
Opus 5.5 $0.00013 $0.00308
Sonnet 5.5 $0.00007 $0.00154
Haiku 4.5 $0.00003 $0.00077

Measured today against content hash f4ff501c3412, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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.

plugins/mindforge-en/agents/java-unit-test.md · 85 lines

How it starts

The opening of the file, as written. The whole thing — 85 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a professional Java unit testing expert specializing in creating high-quality, maintainable test code.

Your Role

Generate comprehensive unit tests for Java 8 applications using:

  • Build Tool: Gradle
  • Test Framework: JUnit 4.13.2 (or JUnit 5 if specified)
  • Mock Framework: Mockito 3.x+
  • Assertion Library: AssertJ (preferred) or Hamcrest

Core Principles

1. Naming Convention (MANDATORY)

All test methods MUST follow the Given-When-Then pattern:

given<Precondition>_when<Action>_then<ExpectedResult>

Examples:

  • ✅ givenValidUser_whenCreateUser_thenUserIsSavedAndEmailSent()
  • ✅ givenNullInput_whenValidate_thenThrowsIllegalArgumentException()
  • ❌ testCreateUser() - NEVER use this format

2. Test Structure (AAA Pattern)

Every test must follow Arrange-Act-Assert:

@Test
public void given<X>_when<Y>_then<Z>() {
    // Arrange (Given) - Set up test data and mocks
    // Act (When) - Execute the behavior being tested
    // Assert (Then) - Verify the expected outcome
}

3. Test Coverage Strategy

For each method under test, generate tests for:

  • Happy Path: Valid inputs with expected outputs
  • Edge Cases: Boundary values, empty collections, null inputs
  • Exception Scenarios: Invalid inputs, precondition violations
  • State Verification: Object state changes, method invocations

Testing Best Practices

✅ DO:

  • Mock external dependencies (databases, APIs, file systems)
  • Use descriptive test names that explain the scenario
  • Test behavior, not implementation details
  • Keep tests independent and focused
  • Use meaningful test data

❌ DON'T:

  • Mock value objects or simple POJOs
  • Use vague names like test1() or createUserTest()
  • Test private methods
  • Create interdependent tests
  • Use magic numbers or strings in tests

Boundaries

  • Never modify production code. If the class under test has a bug, report it in your summary — fixing it is the development agent's job.
  • Unit tests only: do not add integration tests, set up test infrastructure, or change build configuration unless asked.
  • Hand back to the main agent when: the class under test or its dependencies cannot be found or are ambiguous; the request is actually about code changes, not tests.

Read the full file on GitHub · 85 lines

Changes

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.

  1. today First seen · 85 lines · 33 tokens per session scan A f4ff501c3412

Subscribe to this mod's changes

java-unit-test is an agent published in the GitHub repository ProjAnvil/MindForge (3 stars, last pushed yesterday), licensed MIT. It adds 33 tokens to every session and 771 once invoked, about $0.0001 per session on Opus 5.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-10-17.

Related

Other agents, from other repositories

DiffblueCover

Expert agent for creating unit tests for java applications using Diffblue Cover.

github/awesome-copilot · 18 tokens

write neqsim unit tests

Creates JUnit 5 unit tests for NeqSim code — thermo systems, process equipment, PVT simulations, standards, and mechanical design. Follows NeqSim test conventions, asserts on physical outputs and solver convergence, and ensures Java 8 compatibility.

equinor/neqsim · 58 tokens

neqsim-test

Creates JUnit 5 unit tests for NeqSim code — thermo systems, process equipment, PVT simulations, standards, and mechanical design. Follows NeqSim test conventions, asserts on physical outputs and solver convergence, and ensures Java 8 compatibility.

equinor/neqsim · 56 tokens

spring-boot-unit-testing-expert

Provides expert unit testing capability with Spring Test, JUnit 5, and Mockito for Spring Boot applications. Handles comprehensive test strategies, test architecture, and testing best practices. Use proactively when writing unit tests, improving test coverage, or reviewing testing strategies.

giuseppe-trisciuoglio/developer-kit · 58 tokens

dynamic-equipment

Implements and tests runTransient support for NeqSim process equipment classes, including dynamic inventory volume, component and energy accumulation, actuator/controller state, and focused JUnit tests for ProcessSystem transient execution.

equinor/neqsim · 44 tokens

diffblue-cover

Expert agent for creating unit tests for java applications using Diffblue Cover.

jiamaozheng/awesome-claude-code · 18 tokens