Agent skill · software engineering · sickn33

junit-5-skill

Generates production-grade JUnit 5 unit and integration tests in Java. Covers assertions, parameterized tests, lifecycle hooks, mocking with Mockito, and nested tests. Use when user mentions \"JUnit\", \"JUnit 5\", \"@Test\", \"assertEquals\", \"Assertions\", \"Java unit test\".

Why this skill is useful

Generates specific JUnit 5 test patterns and Mockito mocking examples that the AI wouldn't reliably produce on its own.

What it needs

About 3k tokens when loaded. Last updated 2026-08-07. 44,571 stars on the source repository.

What this skill does

JUnit 5 Testing Skill When to Use Use this skill when you need generates production-grade JUnit 5 unit and integration tests in Java. Covers assertions, parameterized tests, lifecycle hooks, mocking with Mockito, and nested tests. Use when user mentions "JUnit", "JUnit 5", "@Test", "assertEquals", "Assertions", "Java unit test". Triggers on:... You are a senior Java developer specializing in JUnit 5 testing. Step 1 — Test Type Core Patterns Basic Test Assertions Reference Parameterized Tests Mocking with Mockito Nested Tests Anti-Patterns Bad Good Why ----- ------ ----- @Test public void test1() @Test void shouldCalculateSum() Descriptive names Testing private methods Test via public API Implementation detail No @DisplayName Always add display names Better reporting assertEquals(true, x) assertTrue(x) More readable Maven Dependencies Quick Reference Task Command ------ --------- Run all mvn test or ./gradlew test Run class mvn test -Dtest=UserServiceTest Run method mvn test -Dtest=UserServiceTest#createUsersucceeds Run tagged @Tag("slow") + mvn test -Dgroups="slow" Disable @Disabled("Reason") Conditional @EnabledOnOs(OS.LINUX) Timeout @Timeout(value = 5, unit = TimeUnit.SECONDS) Repeated @RepeatedTest(5) Order @TestMethodOrder(MethodOrderer.OrderAnnotation.class) Deep Patterns For production-grade patterns, see reference/playbook.md: Section What's Inside --------- -------------- §1 Project Setup Maven deps, parallel config, surefire §2 Test Lifecycle BeforeAll/Each, ordering, tags §3 Parameterized CsvSource, MethodSource, EnumSource, ValueSource §4 Mockito @Mock/@InjectMocks, captor, verify order §5 Nested & Dynamic @Nested grouping, @TestFactory §6 AssertJ Fluent assertions, extracting, collection checks §7 Conditional @EnabledOnOs, assumptions, @EnabledIf §8 Custom Extensions Timing, retry, BeforeTestExecution §9 CI/CD GitHub Actions with test reporter §10 Debugging Table 8 common problems with fixes §11 Best Practices 12-item production checklist Limitations Use …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills sickn33/junit-5-skill

View the source on GitHub

Browse the @skills marketplace