agentsclimarketplace

Java testing

Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/java-testing

🧠 The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.

Install
npx -y skills add ComeOnOliver/skillshub --skill java-testing

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

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)

SKILL.md

2.1 KB, 469 tokens by cl100k_base, as published. Nobody here has run it

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 JUnit assertEquals — enhanced readability.
  • Naming: Use MethodName_State_Result or @DisplayName("Check if X when Y").
  • Parameterized Tests: Use @ParameterizedTest with @ValueSource, @CsvSource, or @MethodSource.
  • Mocking Strategy: Use Mockito with @ExtendWith(MockitoExtension.class) (JUnit 5). Use @Mock, @Spy, and @InjectMocks. NEVER mock data-only Records.
  • Integration Testing: Use Testcontainers with @Container annotation for real databases (PostgreSQL/Redis) in integration tests (*IT.java).
  • Isolation: Each test method MUST be isolated and independent; use @DirtiesContext sparingly.
  • 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), not assertTrue(a == b).
  • No Shared State: Tests must be isolated and order-independent.

References

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.