test: ダイアログテストとUseCaseテストの整備#103
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 4 |
| Duplication | -4 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
📝 WalkthroughWalkthrough複数のダイアログユニットテストとドメインレイヤーのユースケーステストを統一的に改編しました。従来は UI 表示確認とコールバック検証を別々のテストメソッドで実施していましたが、これらを同一テスト内に統合し、テスト名を日本語化して可読性を向上させました。 Changesドメイン層とダイアログテスト構造の統一化
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
feature/settings/src/test/java/kurou/androidpods/feature/settings/RssiThresholdDialogTest.kt (1)
17-17: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win画面方向の指定が必要です。
コーディングガイドラインに従い、
@Configアノテーションに画面方向を指定する必要があります。ポートレート用に@Config(sdk = [35], qualifiers = "port")またはランドスケープ用に@Config(sdk = [35], qualifiers = "land")を使用してください。💡 提案される修正
-@Config(sdk = [35]) +@Config(sdk = [35], qualifiers = "port")コーディングガイドラインより:「Specify screen orientation with
@Config(qualifiers = "port")for portrait or@Config(qualifiers = "land")for landscape.」🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@feature/settings/src/test/java/kurou/androidpods/feature/settings/RssiThresholdDialogTest.kt` at line 17, Update the `@Config` annotation on the RssiThresholdDialogTest (the test class or annotated test function using `@Config`(sdk = [35])) to include a screen orientation qualifier; e.g. change `@Config`(sdk = [35]) to `@Config`(sdk = [35], qualifiers = "port") for portrait or qualifiers = "land" for landscape so the test follows the coding guideline requiring explicit screen orientation.feature/settings/src/test/java/kurou/androidpods/feature/settings/PermissionRequiredDialogTest.kt (1)
15-15: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win画面方向の指定が必要です。
コーディングガイドラインに従い、
@Configアノテーションに画面方向を指定する必要があります。ポートレート用に@Config(sdk = [35], qualifiers = "port")またはランドスケープ用に@Config(sdk = [35], qualifiers = "land")を使用してください。💡 提案される修正
-@Config(sdk = [35]) +@Config(sdk = [35], qualifiers = "port")コーディングガイドラインより:「Specify screen orientation with
@Config(qualifiers = "port")for portrait or@Config(qualifiers = "land")for landscape.」🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@feature/settings/src/test/java/kurou/androidpods/feature/settings/PermissionRequiredDialogTest.kt` at line 15, The `@Config` annotation in PermissionRequiredDialogTest (the PermissionRequiredDialogTest class / test file) is missing a screen orientation qualifier; update the `@Config`(sdk = [35]) usage to include qualifiers = "port" for portrait or qualifiers = "land" for landscape (e.g., replace or augment the existing `@Config` on PermissionRequiredDialogTest with `@Config`(sdk = [35], qualifiers = "port") or `@Config`(sdk = [35], qualifiers = "land") as required by the coding guideline).feature/settings/src/test/java/kurou/androidpods/feature/settings/ThemeModeDialogTest.kt (1)
17-17: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win画面方向の指定が必要です。
コーディングガイドラインに従い、
@Configアノテーションに画面方向を指定する必要があります。ポートレート用に@Config(sdk = [35], qualifiers = "port")またはランドスケープ用に@Config(sdk = [35], qualifiers = "land")を使用してください。💡 提案される修正
-@Config(sdk = [35]) +@Config(sdk = [35], qualifiers = "port")コーディングガイドラインより:「Specify screen orientation with
@Config(qualifiers = "port")for portrait or@Config(qualifiers = "land")for landscape.」🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@feature/settings/src/test/java/kurou/androidpods/feature/settings/ThemeModeDialogTest.kt` at line 17, The test annotation `@Config`(sdk = [35]) on ThemeModeDialogTest must include a screen orientation qualifier; update the `@Config` on the ThemeModeDialogTest class or the specific test method to include qualifiers = "port" (for portrait) or qualifiers = "land" (for landscape), e.g. replace `@Config`(sdk = [35]) with `@Config`(sdk = [35], qualifiers = "port") or `@Config`(sdk = [35], qualifiers = "land") so the test follows the coding guideline.feature/settings/src/test/java/kurou/androidpods/feature/settings/OverlayPositionDialogTest.kt (1)
17-17: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win画面方向の指定が必要です。
コーディングガイドラインに従い、
@Configアノテーションに画面方向を指定する必要があります。ポートレート用に@Config(sdk = [35], qualifiers = "port")またはランドスケープ用に@Config(sdk = [35], qualifiers = "land")を使用してください。💡 提案される修正
-@Config(sdk = [35]) +@Config(sdk = [35], qualifiers = "port")コーディングガイドラインより:「Specify screen orientation with
@Config(qualifiers = "port")for portrait or@Config(qualifiers = "land")for landscape.」🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@feature/settings/src/test/java/kurou/androidpods/feature/settings/OverlayPositionDialogTest.kt` at line 17, The `@Config` annotation on OverlayPositionDialogTest (the line with `@Config`(sdk = [35])) must include a screen orientation qualifier; update that annotation to include qualifiers = "port" for portrait (or "land" for landscape) so it reads `@Config`(sdk = [35], qualifiers = "port") (or "land") to comply with the coding guideline.
🧹 Nitpick comments (1)
core/domain/src/test/java/kurou/androidpods/core/domain/RssiThresholdUseCaseTest.kt (1)
31-51: ⚡ Quick winエラーケーステストの追加を検討してください
コーディングガイドラインでは「3-axis thinking: normal cases, error cases, and boundary values (approximately 1 test per axis)」を推奨しています。現在のテストは正常系のみをカバーしています。
RssiThresholdUseCaseの実装が単純な委譲(例:fun observe() = repository.observe())であれば現状で十分ですが、何らかのロジックを含む場合は、以下のようなエラーケースの追加を検討してください:
repository.observe()が例外をスローする場合repository.update()が失敗する場合実装内容に応じて判断してください。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@core/domain/src/test/java/kurou/androidpods/core/domain/RssiThresholdUseCaseTest.kt` around lines 31 - 51, Add tests for error cases of RssiThresholdUseCase: write one test where repository.observe() is stubbed to throw (e.g., every { repository.observe() } throws SomeException) and assert that useCase.observe() propagates or handles the exception as expected (use runTest and assertThrows or collect the Flow error), and another test where repository.update(...) fails (stub repository.update(RssiThreshold.NEAR) to throw or return a failed result) and assert useCase.update(...) either throws or returns the expected failure; in both tests use coVerify/verify to ensure repository.observe() or repository.update(...) was called and confirmVerified(repository) to finish.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@feature/settings/src/test/java/kurou/androidpods/feature/settings/OverlayPositionDialogTest.kt`:
- Line 17: The `@Config` annotation on OverlayPositionDialogTest (the line with
`@Config`(sdk = [35])) must include a screen orientation qualifier; update that
annotation to include qualifiers = "port" for portrait (or "land" for landscape)
so it reads `@Config`(sdk = [35], qualifiers = "port") (or "land") to comply with
the coding guideline.
In
`@feature/settings/src/test/java/kurou/androidpods/feature/settings/PermissionRequiredDialogTest.kt`:
- Line 15: The `@Config` annotation in PermissionRequiredDialogTest (the
PermissionRequiredDialogTest class / test file) is missing a screen orientation
qualifier; update the `@Config`(sdk = [35]) usage to include qualifiers = "port"
for portrait or qualifiers = "land" for landscape (e.g., replace or augment the
existing `@Config` on PermissionRequiredDialogTest with `@Config`(sdk = [35],
qualifiers = "port") or `@Config`(sdk = [35], qualifiers = "land") as required by
the coding guideline).
In
`@feature/settings/src/test/java/kurou/androidpods/feature/settings/RssiThresholdDialogTest.kt`:
- Line 17: Update the `@Config` annotation on the RssiThresholdDialogTest (the
test class or annotated test function using `@Config`(sdk = [35])) to include a
screen orientation qualifier; e.g. change `@Config`(sdk = [35]) to `@Config`(sdk =
[35], qualifiers = "port") for portrait or qualifiers = "land" for landscape so
the test follows the coding guideline requiring explicit screen orientation.
In
`@feature/settings/src/test/java/kurou/androidpods/feature/settings/ThemeModeDialogTest.kt`:
- Line 17: The test annotation `@Config`(sdk = [35]) on ThemeModeDialogTest must
include a screen orientation qualifier; update the `@Config` on the
ThemeModeDialogTest class or the specific test method to include qualifiers =
"port" (for portrait) or qualifiers = "land" (for landscape), e.g. replace
`@Config`(sdk = [35]) with `@Config`(sdk = [35], qualifiers = "port") or `@Config`(sdk
= [35], qualifiers = "land") so the test follows the coding guideline.
---
Nitpick comments:
In
`@core/domain/src/test/java/kurou/androidpods/core/domain/RssiThresholdUseCaseTest.kt`:
- Around line 31-51: Add tests for error cases of RssiThresholdUseCase: write
one test where repository.observe() is stubbed to throw (e.g., every {
repository.observe() } throws SomeException) and assert that useCase.observe()
propagates or handles the exception as expected (use runTest and assertThrows or
collect the Flow error), and another test where repository.update(...) fails
(stub repository.update(RssiThreshold.NEAR) to throw or return a failed result)
and assert useCase.update(...) either throws or returns the expected failure; in
both tests use coVerify/verify to ensure repository.observe() or
repository.update(...) was called and confirmVerified(repository) to finish.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0ab9f830-05a0-4bbb-bff5-0d8155bbe272
📒 Files selected for processing (8)
core/domain/src/test/java/kurou/androidpods/core/domain/RssiThresholdUseCaseTest.ktfeature/onboarding/src/test/java/kurou/androidpods/feature/onboarding/BluetoothDeniedDialogTest.ktfeature/onboarding/src/test/java/kurou/androidpods/feature/onboarding/BluetoothUnavailableDialogTest.ktfeature/onboarding/src/test/java/kurou/androidpods/feature/onboarding/PermissionDeniedDialogTest.ktfeature/settings/src/test/java/kurou/androidpods/feature/settings/OverlayPositionDialogTest.ktfeature/settings/src/test/java/kurou/androidpods/feature/settings/PermissionRequiredDialogTest.ktfeature/settings/src/test/java/kurou/androidpods/feature/settings/RssiThresholdDialogTest.ktfeature/settings/src/test/java/kurou/androidpods/feature/settings/ThemeModeDialogTest.kt
|



Summary
RssiThresholdUseCaseのユニットテストを新規追加(observe/updateの委譲確認)feature/settingsとfeature/onboardingのダイアログテストを「表示確認+アクション」と「キャンセルを押す」の2ケース構成に統一BluetoothUnavailableDialogはキャンセルボタンがないため1ケース構成qodana_code_quality.ymlを削除し、Qodana ジョブをon-pull-request.yml/on-main-merge.ymlに統合Test plan
./gradlew :core:domain:testDebugUnitTest— RssiThresholdUseCaseTest 通過./gradlew :feature:settings:testDebugUnitTest— 全ダイアログテスト通過./gradlew :feature:onboarding:testDebugUnitTest— 全ダイアログテスト通過🤖 Generated with Claude Code