JUnit 5 Testing

JUnit 5 Testing is a skill for Claude Code, Codex from PramodDutta/qaskills. It costs 36 tokens per session (3,629 once invoked), scanned A, original, MIT.

A guide to writing Java tests with JUnit 5, including assertions, repeated input checks, lifecycle hooks, nested tests, and Mockito-based test doubles.

In plain words
What is it for?
Use it to create, review, or debug Java unit and integration tests and to test several inputs without duplicating test code.
Why use it?
It helps you isolate code from databases, web services, and other outside systems while keeping each test focused and readable.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for aider. Also seen: mentions Codex; built for aider.

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.

agentmods
npx agentmods add skills/pramoddutta/qaskills/junit5-testing
Any agent
npx skills add PramodDutta/qaskills --skill junit5-testing
Clone the repo
git clone --depth 1 https://github.com/PramodDutta/qaskills

Made for: Claude Code, Codex.

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 JUnit 5 Testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/pramoddutta/qaskills/junit5-testing.svg)](https://agentmods.dev/skills/pramoddutta/qaskills/junit5-testing)
Your own site
<a href="https://agentmods.dev/skills/pramoddutta/qaskills/junit5-testing"><img src="https://agentmods.dev/badge/skills/pramoddutta/qaskills/junit5-testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,629 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00036 $0.03629
Opus 5 $0.00018 $0.01814
Sonnet 5 $0.00007 $0.00726
Haiku 4.5 $0.00004 $0.00363

Measured 2d ago against content hash 3a89c240b62f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

JUnit 5 Testing 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 2d ago.

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.

seed-skills/junit5-testing/SKILL.md · 493 lines

How it starts

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

JUnit 5 Testing Skill

You are an expert Java developer specializing in testing with JUnit 5 (Jupiter). When the user asks you to write, review, or debug JUnit 5 tests, follow these detailed instructions to produce production-grade test suites with clear structure, comprehensive assertions, and effective use of the JUnit 5 API.

Core Principles

  1. Test behavior, not implementation -- Verify what the code does from a caller's perspective, not internal mechanics that may change during refactoring.
  2. One logical assertion per test -- Each @Test method should verify a single behavior so failures pinpoint the exact issue immediately.
  3. Arrange-Act-Assert -- Structure every test into setup, execution, and verification sections separated by blank lines.
  4. Isolate external dependencies -- Use Mockito to mock databases, HTTP clients, and third-party services in unit tests.
  5. Descriptive display names -- Use @DisplayName to create human-readable test descriptions that serve as living documentation.
  6. Leverage parameterized tests -- Use @ParameterizedTest with sources like @ValueSource, @CsvSource, and @MethodSource to test multiple inputs without code duplication.
  7. Use nested tests for organization -- Group related tests with @Nested inner classes to mirror conditions and behavior hierarchies.

Project Structure

src/
  main/java/com/example/
    service/
      UserService.java
      PaymentService.java
    model/
      User.java
      Order.java
    repository/
      UserRepository.java
    util/
      Validators.java
  test/java/com/example/
    service/
      UserServiceTest.java
      PaymentServiceTest.java
    model/
      UserTest.java
      OrderTest.java
    repository/
      UserRepositoryTest.java
    util/
      ValidatorsTest.java
    integration/
      UserPaymentFlowIT.java
    fixtures/
      TestDataFactory.java
pom.xml (or build.gradle)

Dependencies

Maven (pom.xml)

<dependencies>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>5.11.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>5.14.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.26.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>

Read the full file on GitHub · 493 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. 2d ago First seen · 493 lines · 36 tokens per session scan A 3a89c240b62f

Subscribe to this mod's changes

JUnit 5 Testing is a skill published in the GitHub repository PramodDutta/qaskills (217 stars, last pushed 6d ago), licensed MIT. It adds 36 tokens to every session and 3,629 once invoked, about $0.0002 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-03.