Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+23 more

    Spring Boot Unit Test Generator

    by william Harris

    1

    Point your agent at a controller, service, or repository and get a production-quality JUnit 5 + Mockito test suite — edge cases included, quality-gated, and run before delivery.

    $9

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Spring Boot Unit Test Generator

    Spring Boot Unit Test Generator

    Example session with this skill installed

    Generate a production-quality JUnit 5 + Mockito test suite for my inventory/order module — a controller, a service, 2 repositories, and 2 pure components. Detect my Spring Boot and JUnit versions first, build a per-method test plan covering boundaries, nulls, exception paths and side effects, generate layer-correct tests (@WebMvcTest for the controller, Mockito with captors for the service, @DataJpaTest for custom queries), run the quality gate, execute the suite, and report any real bugs as findings instead of weakening tests to pass.

    • Read your context and instructions
    • Compiled the spring boot unit

    Generated suite: 36 tests across 5 classes

    • @WebMvcTest controller tests with MockMvc asserting exact status codes and JSON bodies
    • Mockito service tests with argument captors verifying saved state and a fixed Clock for time-dependent logic
    • @DataJpaTest tests for custom repository queries
    • Parameterized component tables for the 2 pure components, covering exact boundary values, null and empty inputs, and half-cent money rounding

    Buggy run (8 planted bugs): 11 failing — all 8 bugs caught, including:

    • B5: "Status expected:<201> but was:<200>" (wrong HTTP status code)
    • B6: "expected: 7 but was: 9" (stock decremented by 1 instead of by quantity)
    • Plus the off-by-one stock check, wrong discount math, null-code NPE, swallowed persistence exception, tax rounding error, and missing quantity validation

    Fixed run: 36/36 pass, BUILD SUCCESS, 0 false positives.

    Quality gate: 0 hints on the generated suite; 8 correct hints on a deliberately bad test file (assertion-free and verify-only tests flagged).

    Any test exposing a real bug is reported as a finding with the failing input — never quietly weakened to pass.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Spring Boot Unit Test Generator — JUnit 5 + Mockito tests that catch real bugs

    Most AI-generated tests are decoration: they mock everything, assert almost nothing, and pass against code that is quietly broken. This skill generates tests the way a careful engineer writes them — and proves it with a rehearsal in which the generated suite catches 8 out of 8 planted bugs (off-by-one stock check, wrong discount math, a null-code NPE, a swallowed persistence exception, a wrong HTTP status code, stock decremented by 1 instead of by quantity, a tax rounding error, and missing quantity validation). It detects your stack first (Spring Boot version, jakarta/javax, @MockBean/@MockitoBean, JUnit version, existing test style) so tests compile in your project. Every public method gets a behavior list before any code: happy path, exact boundary values, null and empty inputs, exception paths, side effects, idempotency. Tests are layer-correct: @WebMvcTest + MockMvc for controllers asserting exact status codes and JSON bodies; plain Mockito for services with argument captors verifying saved state; @DataJpaTest only for custom repository queries. A bundled quality gate flags assertion-free tests, verify-only tests, mocking the class under test, Thread.sleep, and real-clock reads. The suite is run before delivery: compile errors are fixed, and any test exposing a real bug is reported as a finding with the failing input — never quietly weakened to pass. No credentials, no network calls, nothing uploaded — the skill reads only the files you point it at.

    What it does

    1. Detects your stack and matches your Spring Boot/JUnit versions and test style.
    2. Builds a per-method test plan (boundaries, nulls, exceptions, side effects) before writing code.
    3. Generates layer-correct tests: @WebMvcTest controllers, Mockito services with captors, @DataJpaTest custom queries.
    4. Covers production edge cases: ordering exactly the remaining stock, null discount codes, half-cent money rounding, repositories throwing mid-save, negative quantities.
    5. Runs a quality gate that rejects assertion-free or verify-only tests.
    6. Executes the suite and reports real bugs as findings instead of weakening tests.

    How it works

    1. Stack detection from your build file.
    2. Test plan per public method.
    3. Per-layer test generation.
    4. Quality-gate scan.
    5. Run the suite, fix compile errors, report findings.

    What's included

    • SKILL.md (full workflow)
    • reference/test-checklist.md (planning + edge-case catalog)
    • reference/mocking-guide.md (mock/fake/real decisions, captors, Clock injection, H2 vs Testcontainers)
    • reference/examples.md (ten worked examples)
    • reference/rehearsal.md (complete 8-bug rehearsal with verified results)
    • examples/sample-project/ (runnable Maven project — mvn test passes)
    • scripts/test_quality_check.py (quality-gate scanner, Python 3 stdlib only)

    Who it's for

    Java/Spring Boot developers who need tests for existing code; teams raising coverage on legacy services; anyone tired of AI-generated tests that assert nothing; adding tests before a refactor; verifying a bug fix with a regression test; preparing a module for release.

    Targets Spring Boot 3.x / JUnit 5 / Mockito 5 conventions; Boot 2.x differences are documented in the mocking guide but not rehearsed. Repository tests need H2 or Testcontainers. The quality gate checks test form and smells; it cannot judge whether a business assertion matches your spec. Requires spring-boot-starter-test in the project (the skill shows the dependency if missing).

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed today

    Software
    spring-boot-starter-testPython 3 (quality-gate script, stdlib only)
    Optional
    H2
    orTestcontainers (repository tests)

    No credentials or network calls; reads only the files you point it at. If spring-boot-starter-test is missing, the skill shows the dependency to add.

    Permissions

    Terminal / Shell
    Read Files
    Write Files

    File Scopes

    src/**

    Reads source files you point it at, writes generated tests under src/test, and runs the suite (e.g. mvn test) via terminal. No network calls or credentials.

    Listedtoday

    What's inside

    Frequently Asked Questions

    The skill detects your Spring Boot and JUnit versions first (jakarta/javax, @MockBean vs @MockitoBean) and matches your existing test style.

    Compile errors are fixed. A test that exposes a real bug in your code is reported as a finding with the failing input — never weakened to pass.

    No. Controllers use @WebMvcTest, repositories use @DataJpaTest for custom queries, and pure components are tested for real; the mocking guide decides mock vs fake vs real per dependency.

    Rehearsed on Spring Boot 3.4.1 / JUnit 5 / Mockito 5; Boot 2.x differences are called out in the guide.

    No. It reads only the files you point it at; the quality-gate script is local and read-only.

    New in Testing & Debugging

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.