Skip to content

[Unit Tests] Add Tier 2 coverage for 6 quest objective types#309

Open
DiamondDagger590 wants to merge 1 commit into
recodefrom
claude/magical-cray-547ixg
Open

[Unit Tests] Add Tier 2 coverage for 6 quest objective types#309
DiamondDagger590 wants to merge 1 commit into
recodefrom
claude/magical-cray-547ixg

Conversation

@DiamondDagger590

@DiamondDagger590 DiamondDagger590 commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add extended coverage tests (Tier 2) for 6 quest objective types: ItemPickup, VillagerTrade, TameAnimal, ShearEntity, LaunchProjectile, and FertilizeBlock
  • Each test file covers canProcess, processProgress (empty filter, with filter, wrong context type), identity (key namespace/value, expansion key), and parseConfig (new instance, no-key empty filter, with-entries filtering, empty-list empty filter)
  • 103 new tests total, all passing (only pre-existing 6 failures in QuestRewardDistributionResolverPotBehaviorTest remain)

Details

All 6 test files follow the established BlockBreakObjectiveTypeCoverageTest pattern:

  • Extend McRPGBaseTest (required for CustomItemWrapper/CustomEntityWrapper/CustomBlockWrapper registry access)
  • Use @Nested classes to group related test scenarios
  • Follow @Test before @DisplayName annotation ordering
  • Use action_outcome_whenCondition method naming convention
  • Each test has at least one assertion

Amount-based types (ItemPickup, VillagerTrade) verify stack amounts (1, 3, 5, 7, 12, 64) rather than flat 1.
Entity-based types (TameAnimal, ShearEntity) filter via CustomEntityWrapper.
LaunchProjectile filters via EntityType directly (no wrapper).
FertilizeBlock filters via CustomBlockWrapper.

Test plan

  • All 103 new tests pass
  • Full suite passes (4978 tests, 6 pre-existing failures only)
  • Testing audit persona reviewed — no blocking concerns found

🤖 Generated with Claude Code

https://claude.ai/code/session_01GkwBKsKUjJQV5qnFXzHxqu


Generated by Claude Code

Summary by CodeRabbit

  • Tests
    • Expanded automated coverage for fertilizing blocks, picking up items, launching projectiles, shearing entities, taming animals, and trading with villagers.
    • Verified valid and invalid event handling, progress calculations, filtering behavior, configuration parsing, and objective identity metadata.
    • Added coverage for missing and empty filter configurations to confirm expected default behavior.

Add extended coverage tests for ItemPickup, VillagerTrade, TameAnimal,
ShearEntity, LaunchProjectile, and FertilizeBlock objective types.
Each test covers canProcess, processProgress (empty/filtered/wrong
context), identity, and parseConfig branches.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GkwBKsKUjJQV5qnFXzHxqu
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Added six JUnit 5 coverage suites for built-in quest objective types. Tests cover context compatibility, progress calculations, material/entity/projectile filtering, identity keys, expansion keys, configuration parsing, and mocked Bukkit events.

Changes

Built-in objective type coverage

Layer / File(s) Summary
Context acceptance and test setup
src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/*CoverageTest.java
Initializes each objective type and verifies canProcess accepts its matching quest context while rejecting unrelated contexts.
Progress calculation and event fixtures
src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/*CoverageTest.java
Validates default and configured progress behavior, wrong-context results, and mocked Bukkit event inputs across block, item, projectile, shear, tame, and trade objectives.
Identity and configuration parsing
src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/*CoverageTest.java
Checks objective keys, expansion keys, parsed instance creation, and missing, empty, or populated filters.

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

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the PR's main change: adding Tier 2 unit test coverage for six quest objective types.
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-547ixg

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.

Actionable comments posted: 1

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

Inline comments:
In
`@src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/FertilizeBlockObjectiveTypeCoverageTest.java`:
- Line 25: Convert all six Mockito-only coverage test classes to plain JUnit
tests by removing McRPGBaseTest inheritance and its unused import from
FertilizeBlockObjectiveTypeCoverageTest, ItemPickupObjectiveTypeCoverageTest,
ShearEntityObjectiveTypeCoverageTest, TameAnimalObjectiveTypeCoverageTest,
VillagerTradeObjectiveTypeCoverageTest, and
LaunchProjectileObjectiveTypeCoverageTest; leave their test behavior unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 235da1fb-658e-4705-a381-0fb9c89c55fa

📥 Commits

Reviewing files that changed from the base of the PR and between 6cd90a4 and 034d744.

📒 Files selected for processing (6)
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/FertilizeBlockObjectiveTypeCoverageTest.java
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/ItemPickupObjectiveTypeCoverageTest.java
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/LaunchProjectileObjectiveTypeCoverageTest.java
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/ShearEntityObjectiveTypeCoverageTest.java
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/TameAnimalObjectiveTypeCoverageTest.java
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/VillagerTradeObjectiveTypeCoverageTest.java

import static org.mockito.Mockito.when;

@DisplayName("FertilizeBlockObjectiveType — extended coverage")
public class FertilizeBlockObjectiveTypeCoverageTest extends McRPGBaseTest {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Remove unnecessary McRPGBaseTest inheritance from these Mockito-only suites.

  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/FertilizeBlockObjectiveTypeCoverageTest.java#L25-L25: remove the superclass and import.
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/ItemPickupObjectiveTypeCoverageTest.java#L26-L26: remove the superclass and import.
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/ShearEntityObjectiveTypeCoverageTest.java#L25-L25: remove the superclass and import.
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/TameAnimalObjectiveTypeCoverageTest.java#L25-L25: remove the superclass and import.
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/VillagerTradeObjectiveTypeCoverageTest.java#L26-L26: remove the superclass and import.
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/LaunchProjectileObjectiveTypeCoverageTest.java#L25-L25: remove the superclass and import.

As per coding guidelines, “A test that extends McRPGBaseTest but uses neither MockBukkit server interaction nor McRPGPlayer tracking should be converted to a plain JUnit test.”

📍 Affects 6 files
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/FertilizeBlockObjectiveTypeCoverageTest.java#L25-L25 (this comment)
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/ItemPickupObjectiveTypeCoverageTest.java#L26-L26
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/ShearEntityObjectiveTypeCoverageTest.java#L25-L25
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/TameAnimalObjectiveTypeCoverageTest.java#L25-L25
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/VillagerTradeObjectiveTypeCoverageTest.java#L26-L26
  • src/test/java/us/eunoians/mcrpg/quest/objective/type/builtin/LaunchProjectileObjectiveTypeCoverageTest.java#L25-L25
🤖 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/quest/objective/type/builtin/FertilizeBlockObjectiveTypeCoverageTest.java`
at line 25, Convert all six Mockito-only coverage test classes to plain JUnit
tests by removing McRPGBaseTest inheritance and its unused import from
FertilizeBlockObjectiveTypeCoverageTest, ItemPickupObjectiveTypeCoverageTest,
ShearEntityObjectiveTypeCoverageTest, TameAnimalObjectiveTypeCoverageTest,
VillagerTradeObjectiveTypeCoverageTest, and
LaunchProjectileObjectiveTypeCoverageTest; leave their test behavior unchanged.

Source: Coding guidelines

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