mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-06-12 03:03:23 +08:00
fix: clarify AssertJ vs JUnit assertion guidance in quarkus-tdd
Changed "Always use AssertJ" to "Prefer AssertJ for value checks" and documented the intended pattern: JUnit assertThrows/assertDoesNotThrow for exception lifecycle, AssertJ for value validation. This matches the actual code examples in the document.
This commit is contained in:
@@ -357,9 +357,10 @@ mvn jacoco:check
|
|||||||
- メッセージバリデーション付き例外シナリオに`assertThrows`を使用
|
- メッセージバリデーション付き例外シナリオに`assertThrows`を使用
|
||||||
|
|
||||||
### アサーション
|
### アサーション
|
||||||
- JUnitアサーションの代わりに**常にAssertJ**(`assertThat`)を使用
|
- 値チェックにはJUnitアサーションより**AssertJを優先**(`assertThat`)
|
||||||
- 読みやすさのためにAssertJのfluent APIを使用
|
- 読みやすさのためにAssertJのfluent APIを使用
|
||||||
- 例外: `assertThatThrownBy(() -> ...).isInstanceOf(...).hasMessageContaining(...)`
|
- 例外: JUnitの`assertThrows`でキャプチャし、AssertJでメッセージを検証
|
||||||
|
- 成功パス: JUnitの`assertDoesNotThrow`を使用
|
||||||
|
|
||||||
### イベント駆動テスト
|
### イベント駆動テスト
|
||||||
- `AdviceWith`と`MockEndpoint`でCamelルートをテスト
|
- `AdviceWith`と`MockEndpoint`でCamelルートをテスト
|
||||||
|
|||||||
@@ -858,9 +858,10 @@ mvn jacoco:check
|
|||||||
- %80+ satır kapsamı, %70+ branch kapsamı hedefleyin
|
- %80+ satır kapsamı, %70+ branch kapsamı hedefleyin
|
||||||
|
|
||||||
### Assertion'lar
|
### Assertion'lar
|
||||||
- JUnit assertion'ları yerine **her zaman AssertJ** (`assertThat`) kullanın
|
- Değer kontrolleri için JUnit assertion'ları yerine **AssertJ'yi tercih edin** (`assertThat`)
|
||||||
- Okunabilirlik için akıcı AssertJ API'si kullanın: `assertThat(list).hasSize(3).contains(item)`
|
- Okunabilirlik için akıcı AssertJ API'si kullanın: `assertThat(list).hasSize(3).contains(item)`
|
||||||
- Exception'lar için: `assertThatThrownBy(() -> ...).isInstanceOf(...).hasMessageContaining(...)`
|
- Exception'lar için: JUnit `assertThrows` ile yakalayın, ardından AssertJ ile mesajı doğrulayın
|
||||||
|
- Fırlatılmayan başarı yolları için: JUnit `assertDoesNotThrow` kullanın
|
||||||
- Koleksiyonlar için: `extracting()`, `filteredOn()`, `containsExactly()`
|
- Koleksiyonlar için: `extracting()`, `filteredOn()`, `containsExactly()`
|
||||||
|
|
||||||
### Entegrasyon Testi
|
### Entegrasyon Testi
|
||||||
|
|||||||
@@ -357,9 +357,10 @@ mvn jacoco:check
|
|||||||
- 异常场景使用`assertThrows`并验证消息
|
- 异常场景使用`assertThrows`并验证消息
|
||||||
|
|
||||||
### 断言
|
### 断言
|
||||||
- **始终使用AssertJ**(`assertThat`)代替JUnit断言
|
- 值检查**优先使用AssertJ**(`assertThat`)而非JUnit断言
|
||||||
- 使用流式AssertJ API提高可读性
|
- 使用流式AssertJ API提高可读性
|
||||||
- 异常断言: `assertThatThrownBy(() -> ...).isInstanceOf(...).hasMessageContaining(...)`
|
- 异常: 使用JUnit `assertThrows`捕获,再用AssertJ验证消息
|
||||||
|
- 成功路径: 使用JUnit `assertDoesNotThrow`
|
||||||
|
|
||||||
### 事件驱动测试
|
### 事件驱动测试
|
||||||
- 使用`AdviceWith`和`MockEndpoint`测试Camel路由
|
- 使用`AdviceWith`和`MockEndpoint`测试Camel路由
|
||||||
|
|||||||
@@ -861,9 +861,10 @@ mvn jacoco:check
|
|||||||
- Aim for 80%+ line coverage, 70%+ branch coverage
|
- Aim for 80%+ line coverage, 70%+ branch coverage
|
||||||
|
|
||||||
### Assertions
|
### Assertions
|
||||||
- **Always use AssertJ** (`assertThat`) instead of JUnit assertions
|
- **Prefer AssertJ** (`assertThat`) over JUnit assertions for value checks
|
||||||
- Use fluent AssertJ API for readability: `assertThat(list).hasSize(3).contains(item)`
|
- Use fluent AssertJ API for readability: `assertThat(list).hasSize(3).contains(item)`
|
||||||
- For exceptions: `assertThatThrownBy(() -> ...).isInstanceOf(...).hasMessageContaining(...)`
|
- For exceptions: use JUnit `assertThrows` to capture, then AssertJ to validate the message
|
||||||
|
- For non-throwing success paths: use JUnit `assertDoesNotThrow`
|
||||||
- For collections: `extracting()`, `filteredOn()`, `containsExactly()`
|
- For collections: `extracting()`, `filteredOn()`, `containsExactly()`
|
||||||
|
|
||||||
### Testing Integration
|
### Testing Integration
|
||||||
|
|||||||
Reference in New Issue
Block a user