[Unit Tests] Add coverage for mining and herbalism ability configs - #333
[Unit Tests] Add coverage for mining and herbalism ability configs#333DiamondDagger590 wants to merge 2 commits into
Conversation
…r config Cover config-driven ability methods that previously had 0% coverage: - ExtraOre: activation chance with mining_level variable, metadata, multiplier map - ItsATriple: tier-specific vs all-tiers activation chance routing, max tier - TooManyPlants: activation chance with herbalism_level variable, metadata - OreScanner: range formula with tier variable, highest weighted scan type selection Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ViwhAA5UvsysKmRYNMjFhz
- Rename OresScannerConfigTest to OreScannerConfigTest to match production class - Remove unused AbilityHolder import from ExtraOreTest - Remove unused ArgumentMatchers.any import from ItsATripleTest - Add tier-1 boundary tests to ItsATripleTest and OreScannerConfigTest Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ViwhAA5UvsysKmRYNMjFhz
|
Claude finished @DiamondDagger590's task in 2m 10s —— View job Review in progress
|
📝 WalkthroughWalkthroughAdded unit tests for four mining and herbalism abilities. The tests cover configuration setup, activation formulas, metadata, YAML access, tier handling, weighted selection, and initial state. ChangesAbility Test Coverage
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Note
Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.
🟡 Other comments (1)
src/test/java/us/eunoians/mcrpg/ability/impl/herbalism/TooManyPlantsTest.java-113-117 (1)
113-117: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAssert the configured Herbalism document.
assertNotNullpasses whengetYamlDocument()returns any document. Assert that it returnsherbalismConfig. This detects an incorrect configuration-file route.As per coding guidelines, test new public methods with non-trivial logic.
Proposed fix
import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; - assertNotNull(tooManyPlants.getYamlDocument()); + assertSame(herbalismConfig, tooManyPlants.getYamlDocument());🤖 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 `@src/test/java/us/eunoians/mcrpg/ability/impl/herbalism/TooManyPlantsTest.java` around lines 113 - 117, Update getYamlDocument_returnsNonNull in TooManyPlantsTest to assert that tooManyPlants.getYamlDocument() returns the configured herbalismConfig instance, replacing the non-null-only assertion while preserving the test’s existing purpose.Source: Coding guidelines
🤖 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.
Other comments:
In
`@src/test/java/us/eunoians/mcrpg/ability/impl/herbalism/TooManyPlantsTest.java`:
- Around line 113-117: Update getYamlDocument_returnsNonNull in
TooManyPlantsTest to assert that tooManyPlants.getYamlDocument() returns the
configured herbalismConfig instance, replacing the non-null-only assertion while
preserving the test’s existing purpose.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: QUIET
Plan: Pro Plus
Run ID: 767651e3-b5c7-41db-861a-47e95dc839dc
📒 Files selected for processing (4)
src/test/java/us/eunoians/mcrpg/ability/impl/herbalism/TooManyPlantsTest.javasrc/test/java/us/eunoians/mcrpg/ability/impl/mining/ExtraOreTest.javasrc/test/java/us/eunoians/mcrpg/ability/impl/mining/ItsATripleTest.javasrc/test/java/us/eunoians/mcrpg/ability/impl/mining/OreScannerConfigTest.java

Summary
ExtraOre,ItsATriple,OreScanner(mining), andTooManyPlants(herbalism) ability config/metadata methodsgetHighestWeightedScanTypeselection logicNew test files
ExtraOreTestExtraOregetActivationChance(formula withmining_level, literal, zero when no data), metadata, multiplier mapItsATripleTestItsATriplegetActivationChance(all-tiers fallback, tier-specific override, tier-1 boundary, tier variable),getMaxTier, metadataOreScannerConfigTestOreScannergetRange(all-tiers fallback, tier-specific, tier-1 boundary, tier variable, fractional truncation),getHighestWeightedScanType(empty, singleton, multiple, equal weight),getMaxTier, metadataTooManyPlantsTestTooManyPlantsgetActivationChance(formula withherbalism_level, literal, zero when no data), metadata, multiplier mapTest plan
./gradlew test— BUILD SUCCESSFUL)Generated by Claude Code
Summary by CodeRabbit