java-testing

Installation
SKILL.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 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.
Installs
1
GitHub Stars
60
First Seen
Jun 12, 2026
java-testing — comeonoliver/skillshub