
131 Java Testing Unit Testing
This is a comprehensive testing modernizer for Java projects. It walks you through migrating from JUnit 4 to JUnit 5, switching to AssertJ's fluent assertions, and applying proper test structure with Given-When-Then. What's useful here is the safety-first approach: it forces you to compile before making changes and verify afterward, which prevents breaking your build mid-refactor. The skill covers the full testing stack including Mockito mocking, parameterized tests, and boundary condition verification using RIGHT-BICEP and CORRECT principles. It's built for teams trying to eliminate common anti-patterns like reflection-based tests and shared mutable state while adopting modern practices like JSpecify null-safety annotations.
- skills.sh installs
- 134
- GitHub stars
- 393
- last updated
- Jun 3, 2026
Install
$ npx -y skills add jabrena/cursor-rules-java --skill 131-java-testing-unit-testing --agent claude-codeInstalls into .claude/skills of the current project.
Files
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.
Constraints
Sponsors
Details
- Repository
- github.com/jabrena/cursor-rules-java
- Categories
- Testing & QA, Java & JVM
- First seen
- Jun 3, 2026
More from jabrena/cursor-rules-java
All 16- 112 Java Maven Plugins133
- 143 Java Functional Exception Handling133
- 122 Java Type Design132
- 144 Java Data Oriented Programming129
- 170 Java Documentation129
- 132 Java Testing Integration Testing128
- 113 Java Maven Documentation125
- 110 Java Maven Best Practices160
- 121 Java Object Oriented Design153
- 124 Java Secure Coding146
- 111 Java Maven Dependencies136
- 125 Java Concurrency135
- 128 Java Generics135
- 141 Java Refactoring With Modern Features135
- 142 Java Functional Programming135