Skip to content

[Unit Tests] Add coverage for mining and herbalism ability configs - #333

Open
DiamondDagger590 wants to merge 2 commits into
recodefrom
claude/magical-cray-6biykk
Open

[Unit Tests] Add coverage for mining and herbalism ability configs#333
DiamondDagger590 wants to merge 2 commits into
recodefrom
claude/magical-cray-6biykk

Conversation

@DiamondDagger590

@DiamondDagger590 DiamondDagger590 commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add unit tests for ExtraOre, ItsATriple, OreScanner (mining), and TooManyPlants (herbalism) ability config/metadata methods
  • All four classes previously had 0% or near-0% test coverage on their non-Bukkit logic
  • Tests cover Parser formula evaluation with skill-level and tier variables, tier-specific vs all-tiers config routing, metadata accessors, and getHighestWeightedScanType selection logic

New test files

File Class under test Tests
ExtraOreTest ExtraOre getActivationChance (formula with mining_level, literal, zero when no data), metadata, multiplier map
ItsATripleTest ItsATriple getActivationChance (all-tiers fallback, tier-specific override, tier-1 boundary, tier variable), getMaxTier, metadata
OreScannerConfigTest OreScanner getRange (all-tiers fallback, tier-specific, tier-1 boundary, tier variable, fractional truncation), getHighestWeightedScanType (empty, singleton, multiple, equal weight), getMaxTier, metadata
TooManyPlantsTest TooManyPlants getActivationChance (formula with herbalism_level, literal, zero when no data), metadata, multiplier map

Test plan

  • All new tests pass (./gradlew test — BUILD SUCCESSFUL)
  • Full test suite passes with zero regressions
  • Testing audit persona reviewed and all findings addressed (class rename, unused imports, tier-1 boundary tests added)

Generated by Claude Code

Summary by CodeRabbit

  • Tests
    • Added comprehensive automated coverage for herbalism and mining abilities.
    • Verified activation chances, fallback behavior, configuration handling, tier and multiplier calculations, metadata, and YAML access.
    • Added coverage for weighted ore scanning and configurable scan ranges.

claude added 2 commits August 10, 2026 09:31
…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
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

Claude finished @DiamondDagger590's task in 2m 10s —— View job


Review in progress

  • Gather context (PR diff, changed files)
  • Route to review lenses (test-only PR → review-testing lens; no src/main changes, so no other lens applies)
  • Fan out lens subagent (review-testing running)
  • Run test suite to confirm green (⚠️ ./gradlew test is blocked by sandbox/tool permissions in this environment — see note below)
  • Consolidate findings
  • Post final review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Added 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.

Changes

Ability Test Coverage

Layer / File(s) Summary
Mining ability behavior tests
src/test/java/us/eunoians/mcrpg/ability/impl/mining/ExtraOreTest.java, src/test/java/us/eunoians/mcrpg/ability/impl/mining/ItsATripleTest.java
Tests cover activation formulas, configuration routes, metadata, YAML access, maximum-tier configuration, and initial multiplier state.
Ore Scanner configuration tests
src/test/java/us/eunoians/mcrpg/ability/impl/mining/OreScannerConfigTest.java
Tests cover tier-based range formulas, tier substitution, fractional truncation, weighted scan-type selection, maximum tier retrieval, and accessors.
Herbalism ability behavior tests
src/test/java/us/eunoians/mcrpg/ability/impl/herbalism/TooManyPlantsTest.java
Tests cover mocked configuration setup, activation formulas, missing data behavior, metadata, YAML access, and initial multiplier state.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the added unit test coverage for mining and herbalism ability configurations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/magical-cray-6biykk

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Assert the configured Herbalism document.

assertNotNull passes when getYamlDocument() returns any document. Assert that it returns herbalismConfig. 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

📥 Commits

Reviewing files that changed from the base of the PR and between cc181c0 and b57f47d.

📒 Files selected for processing (4)
  • src/test/java/us/eunoians/mcrpg/ability/impl/herbalism/TooManyPlantsTest.java
  • src/test/java/us/eunoians/mcrpg/ability/impl/mining/ExtraOreTest.java
  • src/test/java/us/eunoians/mcrpg/ability/impl/mining/ItsATripleTest.java
  • src/test/java/us/eunoians/mcrpg/ability/impl/mining/OreScannerConfigTest.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants