> java-testing
Testing standards using JUnit 5, AssertJ, and Mockito for Java. Use when writing or reviewing Java unit tests, setting up parameterized tests, writing integration tests with Testcontainers, or working with Mockito mocks. (triggers: **/*Test.java, **/*IT.java, @Test, @ParameterizedTest, Mockito, AssertJ, assertThat, JUnit, Testcontainers)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/java-testing?format=md"Java Testing Standards
Priority: P0 (CRITICAL)
High-reliability testing using JUnit 5 and fluent assertions.
Implementation Guidelines
- JUnit 5 (Jupiter): Use
@Test,@BeforeEach, and@AfterEach. Avoid JUnit 4 classes. - Fluent Assertions: Use
AssertJ (assertThat)over JUnitassertEquals— enhanced readability. - Naming: Use
MethodName_State_Resultor@DisplayName("Check if X when Y"). - Parameterized Tests: Use
@ParameterizedTestwith@ValueSource,@CsvSource, or@MethodSource. - Mocking Strategy: Use
Mockitowith@ExtendWith(MockitoExtension.class)(JUnit 5). Use@Mock,@Spy, and@InjectMocks. NEVER mock data-only Records. - Integration Testing: Use
Testcontainerswith@Containerannotation for real databases (PostgreSQL/Redis) in integration tests (*IT.java). - Isolation: Each test method MUST be isolated and independent; use
@DirtiesContextsparingly. - AssertJ Chaining: Chain assertions for clarity:
assertThat(result).isNotNull().hasSize(2).contains("X"). - Mocking verification: Use
verify(mock, times(1)).method()to audit side-effects. - Exceptions: Use
assertThatThrownBy(() -> ...)to verify specific Exception types and messages.
Anti-Patterns
- No Logic in Tests: Keep tests declarative; no loops or if/else branching.
- No System.out in Tests: Use assertions; never print to stdout.
- No Legacy Assertions: Use
assertThat(a).isEqualTo(b), notassertTrue(a == b). - No Shared State: Tests must be isolated and order-independent.
References
> related_skills --same-repo
> common-store-changelog
Generate user-facing release notes for the Apple App Store and Google Play Store by collecting git history, triaging user-impacting changes, and drafting store-compliant changelogs. Enforces character limits (App Store ≤4000, Google Play ≤500), tone, and bullet format. Use when generating release notes, app store changelog, play store release, what's new, or version release notes for any mobile app. (triggers: generate changelog, app store notes, play store release, what's new, release notes, ve
> golang-tooling
Go developer toolchain — gopls LSP diagnostics, linting, formatting, and vet. Use when setting up Go tooling, running linters, or integrating gopls with Claude Code. (triggers: gopls, golangci-lint, golangci.yml, go vet, goimports, staticcheck, go tooling, go lint)
> common-ui-design
Design distinctive, production-grade frontend UI with bold aesthetic choices. Use when building web components, pages, interfaces, dashboards, or applications in any framework (React, Next.js, Angular, Vue, HTML/CSS). (triggers: build a page, create a component, design a dashboard, landing page, UI for, build a layout, make it look good, improve the design, build UI, create interface, design screen)
> common-owasp
OWASP Top 10 audit checklist for Web Applications (2021) and APIs (2023). Load during any security review, PR review, or codebase audit touching web, mobile backend, or API code. (triggers: security review, OWASP, broken access control, IDOR, BOLA, injection, broken auth, API review, authorization, access control)