Claude Marketplaces
SkillsMCP serversMarketplacesDigestTools
Submit

This week in Claude

Every Monday: Claude Code, Agent SDK, MCP, and the Anthropic platform moves worth your time.

Skills by category
Frontend DevelopmentBackend & APIsTesting & QASecurityDevOps & CI/CDGit & Pull RequestsDocumentationCode Review & QualityAI & Agent BuildingSkill Development
MCP servers by category
Sales & MarketingWeb & Browser AutomationDatabasesAI & LLM ToolsCloud & InfrastructureCommunication & MessagingDeveloper ToolsDesign & CreativeDocuments & KnowledgeSearch & Web Crawling
Marketplaces by category
AI Agents & OrchestrationLLM IntegrationDevelopment ToolsFrontend & UIBackend & APIsDatabasesTesting & Code QualityDevOps & CloudSecurity & ComplianceGit & Version Control
Claude Marketplaces

An independent directory of skills, plugins and MCP servers for Claude Code. Not affiliated with Anthropic.

Browse

  • Skills
  • MCP servers
  • Marketplaces
  • Weekly digest
  • Skill index
  • MCP index
  • Marketplace index

Site

  • About
  • Tools
  • Submit
  • Feedback
  • Privacy
  • llms.txt
  • Plugins reference

Maker

  • Snug
  • Agent Caffeine
  • knobs
  • Wax
  • Vectoys
  • mertduzgun.com
Crafted at
Skills/Testing & QA
github avatar

Java Junit

github/awesome-copilotOfficial

This covers JUnit 5 fundamentals through advanced parameterized testing patterns. It's solid for teams standardizing on testing conventions or developers moving from JUnit 4 who need the new annotation syntax and parameterized test approaches. The guidance on @ParameterizedTest with @ValueSource, @CsvSource, and @MethodSource is thorough, plus it includes practical setup for Maven/Gradle dependencies. The test naming conventions and AAA pattern recommendations will help maintain readable test suites. One limitation: it focuses heavily on unit testing mechanics but doesn't dive into integration testing strategies or more complex mocking scenarios beyond basic Mockito usage.

installs
11.7K
GitHub stars
40.5K
last updated
Aug 21, 2026
View on GitHubSave

Install

$ npx -y skills add github/awesome-copilot --skill java-junit --agent claude-code

Installs into .claude/skills of the current project.

Files

Java Testing with JUnit 5/6, AssertJ and Mockito

Framework-neutral guidance for fast, deterministic unit tests. For Spring slices use spring-boot-testing (if installed); for real databases/brokers in Docker use java-testcontainers; for failures you cannot explain, java-debugging.

First: detect, don't impose

  1. Read pom.xml/build.gradle*: JUnit version (junit-jupiter, junit-bom, or inherited from a Spring Boot BOM), assertion library, Mockito, Surefire/Failsafe versions, Java release.
  2. Copy the conventions already in src/test/java (naming, assertion library, static imports, mocking style). Do not introduce AssertJ, Mockito or JaCoCo into a project that lacks them without asking.
  3. Never bump the JUnit major version implicitly; upgrading is its own task (see java-upgrade if installed).

JUnit 5 vs JUnit 6

JUnit 5 (last 5.14.x)JUnit 6 (6.0 released; 6.1.x current)
Java baseline817 (verified in the published Gradle module metadata)
VersioningPlatform 1.x, Jupiter 5.x, Vintage 5.xOne version number for Platform, Jupiter and Vintage
APIorg.junit.jupiter.api.*Same packages; the Jupiter tests in this skill compile and pass unchanged on 5.14.4 and 6.0.3
Removed in 6.0MethodOrderer.Alphanumeric, the deprecated two-argument InvocationInterceptor.interceptDynamicTest(Invocation, ExtensionContext) overload (the three-argument one remains), junit.jupiter.tempdir.scope, @CsvFileSource(lineSeparator)
CSVunivocity-parsersFastCSV: stricter parsing (no characters after a closing quote); header-field options now apply to headers
Otherjunit-jupiter-migrationsupport deprecated; invalid enum-style config values now fail discovery; @Nested class order deterministic but non-obvious

Source: JUnit 6.0.0 release notes (https://docs.junit.org/6.0.0/release-notes.html). Read the notes for the target version (https://docs.junit.org/current/release-notes/) and prefer them over this table. JUnit 4 tests need the Vintage engine; do not mix org.junit.Test and org.junit.jupiter.api.Test in one class.

Dependencies (same for 5 and 6; verified with Maven and Gradle): import org.junit:junit-bom, then declare org.junit.jupiter:junit-jupiter (aggregates api, params, engine) with test scope. Gradle 9 additionally requires testRuntimeOnly("org.junit.platform:junit-platform-launcher") (verified: without it the test executor fails with "Failed to load JUnit Platform") and tasks.test { useJUnitPlatform() }. Maven needs Surefire 3.x (verified with 3.6.0).

Assertions

Match the project's library. Plain Jupiter rules: expected value first, lazy Supplier messages, assertAll, assertThrowsExactly, timeouts. (The separate instructions/java-junit5-assertions.instructions.md resource has the longer version but is not installed with this skill.) If the project uses AssertJ, prefer it for collections, strings and exceptions; patterns (soft assertions, assertThatThrownBy, extracting, containsExactly, usingRecursiveComparison) are in references/assertj-and-mockito.md.

  • Assert on outcomes and state, not on how many times internals were called.
  • Compare values; avoid bare assertNotNull.
  • Never catch AssertionError/Exception to make a test pass.

Mocking (Mockito)

  • Mock collaborators across a boundary (repository, HTTP client, clock, message sender). Do not mock value objects, records, collections, String, or the class under test; use real instances or simple fakes.
  • Prefer a hand-written fake over a mock when the interaction is stateful.
  • Use @ExtendWith(MockitoExtension.class) with @Mock/@InjectMocks/@Captor. Strict stubs are the default there, so an unused stub fails the test (UnnecessaryStubbingException). Fix the test; relax with @MockitoSettings(strictness = Strictness.LENIENT) only for a justified shared setup.
  • Mockito 5 uses the inline mock maker by default. On JDK 21+ it may self-attach and print a dynamic-agent warning. With Mockito 5.14.0+, register mockito-core as a -javaagent instead (setup for Maven and Gradle in references/assertj-and-mockito.md, verified on JDK 21 and 25). Check the resolved version first: earlier 5.x jars lack Premain-Class and cannot be used as the agent. Ask before upgrading; otherwise use the instrumentation setup documented for the installed version.
  • Mockito 5 requires Java 11+. Its default inline mock maker does not work on GraalVM native image, where the subclass mock maker is appropriate (Mockito 5.0.0 release notes, https://github.com/mockito/mockito/releases/tag/v5.0.0).
  • Avoid mockStatic/mockConstruction; wrap the static call behind an interface.

Determinism

  • Time: inject java.time.Clock (Clock.fixed(...)) and call Instant.now(clock); avoid Instant.now()/LocalDate.now() in code under test.
  • Randomness: inject a Random/RandomGenerator with a fixed seed; log the seed if generated.
  • Do not depend on default locale, time zone, file encoding, network, or wall-clock sleeps. Set them explicitly (newer 6.x releases add built-in locale/time-zone/system-property extensions; check the release notes of your version, otherwise use try/finally).

Unit vs integration tests

Unit (*Test)Integration (*IT)
MavenSurefire, mvn testFailsafe, mvn verify
Gradletest taskseparate integrationTest task (JVM Test Suite) wired into check
Speedmilliseconds, no I/Omay use Docker/DB

Surefire defaults pick *Test, Test*, *Tests, *TestCase; Failsafe picks *IT, IT*, *ITCase. Failsafe needs the integration-test and verify goals bound and is run by mvn verify, not mvn test. Alternatively split by @Tag. For databases and brokers see java-testcontainers; for Spring slices see spring-boot-testing. Full build snippets: references/build-setup.md.

Coverage and mutation testing (optional)

  • JaCoCo: add only if the project uses it or the user asks. With Surefire/Failsafe use <argLine>@{argLine} ...</argLine> so the JaCoCo agent is not overwritten.
  • Coverage is a smell detector, not a goal; never add assertion-free tests to raise a number, and do not add a coverage gate the project lacks.
  • PIT (mutation testing) is slow; run it on changed classes only if the project already uses it or the user asks (see references/build-setup.md, which records a verified pitest-maven + JUnit 5 plugin run).

Agent guardrails

  1. Never delete, comment out, @Disabled, weaken (looser assertion, wider tolerance, swallowed exception) or skip a failing test to get green. Find the cause.
  2. Decide which side is wrong, the test or the production code. If the fix changes production behavior, stop and ask the user first; if the test encodes an obviously stale expectation, say so and propose the change.
  3. Do not add -DskipTests, -Dmaven.test.skip, -x test or failIfNoTests=false to make a build pass.
  4. Do not mock the class under test or assert on mock internals to "prove" correctness.
  5. Run the narrowest test first, then the full build:
    • Maven: mvn -q -Dtest=OrdersTest test (one method: -Dtest='OrdersTest#place_should_saveAndNotify_when_itemValid'), then mvn verify.
    • Gradle: ./gradlew test --tests 'demo.OrdersTest', then ./gradlew check. Prefer the project wrapper (./mvnw, ./gradlew) when present.
  6. Flaky test: reproduce by rerunning, then remove the nondeterminism (time, order, shared state, async waits); do not add retries.
  7. New code gets new tests beside the existing ones, in the same style: happy path, boundaries, error cases.

References

  • references/assertj-and-mockito.md: AssertJ patterns, Mockito strictness/captors/agent setup, when not to mock.
  • references/build-setup.md: Maven and Gradle (Kotlin DSL) setups for JUnit 5/6, Failsafe split, JaCoCo, PIT.

Sponsors

SnugThe clipboard manager you and your agent can use, safelyAgent CaffeineClose your lid, come back to finished workWaxBlock anything with supervision, without erasing your iPhoneOpen StepsSponsoredFree and open-source skills that make AI coding agents easier to understand, verify, and control.

Details

Repository
github.com/github/awesome-copilot
Categories
Testing & QA, Git & Pull Requests, AI & Agent Building, Java & JVM

More from github/awesome-copilot

All 318
  • Dotnet Design Pattern Review11.6K
  • Dotnet Upgrade11.5K
  • Apple Appstore Reviewer11.3K
  • Update Implementation Plan11.1K
  • Make Repo Contribution11.1K
  • Review And Refactor11.1K
  • Editorconfig11K
  • Csharp Async10.9K
  • Java Docs10.8K
  • Create Github Action Workflow Specification10.8K
  • Python Mcp Server Generator10.4K
  • Csharp Xunit10.3K
  • Ai Prompt Engineering Safety Review10.3K
  • Agentic Eval10.2K
  • Create Architectural Decision Record10.2K
  • Breakdown Feature Prd10K
  • Refactor Method Complexity Reduce10K
  • Pdftk Server10K
  • Scoutqa Test10K
  • Powerbi Modeling9.9K
  • Nano Banana Pro Openrouter9.9K
  • Markdown To Html9.9K
  • Meeting Minutes9.9K
  • Git Flow Branch Creator9.8K

Recommended

More Testing & QA
1samber avatargolang-refactoringsamber/cc-skills-golangGolang refactoring — the safe, at-scale process for restructuring existing Go code: a coverage-adaptive safety net, tool-driven behavior-preserving transforms (11.5Kinstalls
2wshobson avatardependency-upgradewshobson/agentsManage major dependency version upgrades with compatibility analysis, staged rollout, and comprehensive testing. Use when upgrading framework versions, updating11.2Kinstalls
3alchaincyf avatardarwin-skillalchaincyf/darwin-skillDarwin Skill 2.0 (达尔文.skill 2.0): autonomous skill optimizer, v2.0 integrates Microsoft Research SkillLens (arXiv 2605.23899) 9-dim rubric + SkillOpt (arXiv 26011.2Kinstalls
4wshobson avatarworkflow-patternswshobson/agentsUse this skill when implementing tasks according to Conductor's TDD workflow, handling phase checkpoints, managing git commits for tasks, or understanding the v11.1Kinstalls
5wshobson avatarairflow-dag-patternswshobson/agentsBuild production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workfl11Kinstalls
6wshobson avatardbt-transformation-patternswshobson/agentsMaster dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data trans11Kinstalls