Review and improve Java unit tests using modern JUnit 5, AssertJ, and Mockito best practices.
Prerequisites: Run ./mvnw compile or mvn compile before applying any change. If compilation fails, stop immediately and do not proceed — compilation failure is a blocking condition.
Core areas: 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 with @ValueSource/@CsvSource/@MethodSource, Mockito dependency mocking (@Mock, @InjectMocks, MockitoExte...
JUnit 4에서 JUnit 5로 마이그레이션, 유창한 어설션을 위해 AssertJ 채택, Give-When-Then으로 테스트 구조화, 테스트 독립성 보장, 매개변수화된 테스트 적용, Mockito로 종속성 모의, 경계 조건 확인(RIGHT-BICEP, CORRECT, A-TRIP), JSpecify null 안전성 주석 활용 또는 다음과 같은 안티 패턴 테스트 제거를 포함하여 Java 단위 테스트를 검토, 개선 또는 작성해야 할 때 사용합니다. 반사 기반 테스트 또는 공유된 변경 가능 상태. Skills-for-Java 프로젝트의 일부 출처: jabrena/cursor-rules-java.