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...
Java 単体テストのレビュー、改善、作成が必要な場合に使用します。これには、JUnit 4 から JUnit 5 への移行、流暢なアサーションのための AssertJ の採用、Given-When-Then によるテストの構築、テストの独立性の確保、パラメーター化されたテストの適用、Mockito による依存関係のモック化、境界条件 (RIGHT-BICEP、CORRECT、A-TRIP) の検証、JSpecify null-safety アノテーションの活用、またはテストのアンチパターンの排除が含まれます。リフレクションベースのテストまたは共有可変状態。 Skills-for-Java プロジェクトの一部 ソース: jabrena/cursor-rules-java。