java-junit
Skill by github
Writes, reviews and fixes Java unit tests with JUnit 5 and 6, AssertJ and Mockito in Maven or Gradle projects. It follows existing project conventions and includes guardrails that stop agents from skipping or deleting failing tests. Aimed at Java developers.
Install java-junit
Built from the published package, never by AI.
git clone --depth 1 https://github.com/github/awesome-copilot /tmp/awesome-copilot && mkdir -p ~/.claude/skills && cp -r /tmp/awesome-copilot/skills/java-junit ~/.claude/skills/java-junitRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/github/awesome-copilot /tmp/awesome-copilot && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/awesome-copilot/skills/java-junit ~/.gemini/antigravity-cli/skills/java-junitAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
java-junit is an agent skill that gives an AI assistant guidance for writing, reviewing and fixing Java unit tests with JUnit 5 and JUnit 6 (Jupiter), AssertJ and Mockito. It covers assertions, parameterized and nested tests, mocking rules, deterministic time and randomness, Surefire versus Failsafe, JaCoCo coverage and optional PIT mutation testing.
The skill first reads the pom.xml or Gradle build files and follows the conventions already in src/test/java instead of introducing new libraries. It also sets guardrails for agents, such as never skipping, deleting or weakening a failing test. It is aimed at developers adding, refactoring or debugging tests in Maven or Gradle projects.
Written from the project's SKILL.md and checked against it.
What it can do
- Project detectionReads build files and existing test conventions before changing any tests.
- JUnit 5 and 6 guidanceExplains version differences and dependency setup for Maven and Gradle.
- Mocking rulesMocks collaborators across a boundary and prefers fakes for stateful interactions.
- Deterministic testsInjects a fixed Clock and seeded Random and avoids default locale and sleeps.
- Unit and integration splitCovers Surefire for unit tests and Failsafe for integration tests.
- Coverage and mutation testingCovers JaCoCo agent setup and optional PIT mutation testing.
- Agent guardrailsForbids deleting, disabling or weakening failing tests to get a green build.
- Narrow-first test runsRuns a single test class or method first, then the full build.
What you need
- Java 17 or later for JUnit 6
- Maven or Gradle project
- Surefire 3.x for Maven
- junit-platform-launcher for Gradle 9
Try asking
- Write JUnit 6 tests for OrdersService using Mockito and AssertJ
- Review the unit tests in src/test/java for flaky time handling
- Fix the failing OrdersTest without skipping or deleting it
Good to know
- Does not add AssertJ, Mockito or JaCoCo to a project without asking.
- Mockito's default inline mock maker does not work on GraalVM native image.
- PIT mutation testing is slow and is optional.
- The Mockito agent setup described requires Mockito 5.14.0 or later.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/java-junit/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md8 KB -
references/assertj-and-mockito.md7 KB -
references/build-setup.md5 KB
Alternatives to java-junit
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
java-junit: common questions
Does this skill work with JUnit 6?
Yes. The source describes JUnit 6 with Java 17 as the baseline and says the Jupiter tests in the skill compile and pass on 5.14.4 and 6.0.3.
Can the agent delete a failing test to get a green build?
No. The guardrails say never to delete, comment out, disable or weaken a failing test, and not to add flags such as -DskipTests.
Does it work with both Maven and Gradle?
Yes. It covers Maven with Surefire and Failsafe and Gradle with a test task and a separate integrationTest task, with build snippets in references/build-setup.md.
How do I install java-junit?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is java-junit free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is java-junit safe to use?
It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to java-junit?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
