131-java-testing-unit-testing

Installation
SKILL.md

Java Unit testing guidelines

Review and improve Java unit tests using modern JUnit 5, AssertJ, and Mockito best practices.

What is covered in this Skill?

  • JUnit 5 annotations: @Test, @BeforeEach, @AfterEach, @DisplayName, @Nested, @ParameterizedTest
  • AssertJ fluent assertions: assertThat, assertThatThrownBy
  • Given-When-Then test structure, descriptive test naming, single-responsibility tests
  • Test independence and isolated state
  • Parameterized tests: @ValueSource/@CsvSource/@MethodSource
  • Mockito dependency mocking: @Mock, @InjectMocks, MockitoExtension
  • Code coverage guidance (JaCoCo), package-private test visibility
  • Testing anti-patterns: reflection, shared state, hard-coded values, testing implementation details
  • Error handling: assertThatThrownBy, exception messages
  • JSpecify null-safety: @NullMarked, @Nullable
  • RIGHT-BICEP coverage principles, A-TRIP test quality, CORRECT boundary condition verification

Scope: The reference is organized by examples (good/bad code patterns) for each core area. Apply recommendations based on applicable examples.

Related skills

More from jabrena/cursor-rules-java

Installs
101
GitHub Stars
380
First Seen
Mar 3, 2026