Skip to content

[Unit Tests] Add window boundary type and registry tests, extend scope tests - #335

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

[Unit Tests] Add window boundary type and registry tests, extend scope tests#335
DiamondDagger590 wants to merge 1 commit into
recodefrom
claude/magical-cray-xf97h5

Conversation

@DiamondDagger590

@DiamondDagger590 DiamondDagger590 commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add FixedWindowBoundaryTypeTest (5 tests): covers parse() with valid ISO-8601 dates, null fields, invalid formats, and partial date formats
  • Add RecurringWindowBoundaryTypeTest (7 tests): covers parse() with valid month-day/time, null fields (individual and both), invalid formats, and time without seconds
  • Add WindowBoundaryTypeRegistryTest (7 tests): covers register, registered check, get by key, unknown key, same-key replacement, and multi-type lookup
  • Extend SinglePlayerQuestScopeTest (5 new tests): add @Nested grouping, add tests for getScopeKey(), getQuestUUID(), isPlayerInScope when no player set, saveScope invalid state throws, and getPlayerInScope after set

Coverage impact

Class Before After
FixedWindowBoundaryType 0% 100%
RecurringWindowBoundaryType 0% 100%
WindowBoundaryTypeRegistry 0% 100%
SinglePlayerQuestScope 54.2% ~70% (added getScopeKey, getQuestUUID, isPlayerInScope null path, saveScope guard)

All 24 new/modified tests pass. Full test suite passes with zero failures (./gradlew test).

Test plan

  • All new tests pass individually
  • Full test suite passes with zero regressions
  • Testing audit persona reviewed — no blocking concerns

Generated by Claude Code

Summary by CodeRabbit

  • Tests
    • Expanded automated coverage for quest availability boundary registration, replacement, lookup, and unknown-key handling.
    • Added validation tests for fixed and recurring date/time boundary parsing, including invalid and incomplete values.
    • Improved coverage of single-player quest scope behavior, including player assignment, membership, validity, retrieval, and invalid save scenarios.
    • Organized scope tests with clearer nested structure and display names.

…ests

- Add FixedWindowBoundaryTypeTest: covers parse() with valid ISO-8601 dates,
  null fields, invalid formats, and partial date formats (5 tests)
- Add RecurringWindowBoundaryTypeTest: covers parse() with valid month-day/time,
  null fields (individual and both), invalid formats, and time without seconds
  (7 tests)
- Add WindowBoundaryTypeRegistryTest: covers register, registered check,
  get by key, unknown key, same-key replacement, and multi-type lookup (7 tests)
- Extend SinglePlayerQuestScopeTest: add @nested grouping, add tests for
  getScopeKey(), getQuestUUID(), isPlayerInScope when no player set, saveScope
  invalid state, and getPlayerInScope after set (5 new tests)

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

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

Claude finished @DiamondDagger590's task in 1m 4s —— View job


Claude PR Review — In Progress

  • Gather context (PR diff, changed files)
  • Route to review lenses (test-only PR → review-testing lens applies; no src/main changes, so other lenses are not applicable)
  • Run review-testing lens
  • Consolidate findings
  • Post final review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request adds JUnit coverage for window boundary registration and parsing. It also reorganizes and expands SinglePlayerQuestScopeTest coverage for scope identity, player operations, validity, retrieval, and save behavior.

Changes

Quest test coverage

Layer / File(s) Summary
Boundary type registry tests
src/test/java/us/eunoians/mcrpg/quest/chain/availability/WindowBoundaryTypeRegistryTest.java
Tests registration, same-key replacement, registration checks, unknown keys, and retrieval of multiple boundary types.
Built-in boundary parsing tests
src/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/FixedWindowBoundaryTypeTest.java, src/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/RecurringWindowBoundaryTypeTest.java
Tests boundary keys and parsing for valid, null, invalid, partial, and seconds-free date or time values.
Single-player scope tests
src/test/java/us/eunoians/mcrpg/quest/impl/scope/impl/SinglePlayerQuestScopeTest.java
Groups tests with JUnit 5 nested classes and adds coverage for scope identity, player membership, empty retrieval, validity, and invalid-scope save behavior.

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 window boundary and registry unit tests and the extended scope tests.
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-xf97h5

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/chain/availability/WindowBoundaryTypeRegistryTest.java`:
- Around line 20-23: Convert the three listed test classes to plain JUnit tests
by removing McRPGBaseTest inheritance and its import from
WindowBoundaryTypeRegistryTest.java (lines 20-23),
FixedWindowBoundaryTypeTest.java (lines 22-24), and
RecurringWindowBoundaryTypeTest.java (lines 23-24); leave their test behavior
unchanged.
🪄 Autofix

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: QUIET

Plan: Pro Plus

Run ID: f8297882-6ae2-44b0-a9d6-853fc45edd40

📥 Commits

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

📒 Files selected for processing (4)
  • src/test/java/us/eunoians/mcrpg/quest/chain/availability/WindowBoundaryTypeRegistryTest.java
  • src/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/FixedWindowBoundaryTypeTest.java
  • src/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/RecurringWindowBoundaryTypeTest.java
  • src/test/java/us/eunoians/mcrpg/quest/impl/scope/impl/SinglePlayerQuestScopeTest.java

Comment on lines +20 to +23
@DisplayName("WindowBoundaryTypeRegistry")
class WindowBoundaryTypeRegistryTest extends McRPGBaseTest {

private static final NamespacedKey TEST_KEY = new NamespacedKey("mcrpg", "test_boundary");

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 the unnecessary McRPGBaseTest dependency.

These tests do not require MockBukkit server interaction or McRPGPlayer infrastructure. Use plain JUnit tests. This reduces test setup and isolates the parsing and registry contracts.

  • src/test/java/us/eunoians/mcrpg/quest/chain/availability/WindowBoundaryTypeRegistryTest.java#L20-L23: Remove extends McRPGBaseTest and its import.
  • src/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/FixedWindowBoundaryTypeTest.java#L22-L24: Remove extends McRPGBaseTest and its import.
  • src/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/RecurringWindowBoundaryTypeTest.java#L23-L24: Remove extends McRPGBaseTest and its import.

As per coding guidelines, tests must not extend McRPGBaseTest when they require neither MockBukkit server interaction nor McRPGPlayer tracking. Based on learnings, do not require McRPGBaseTest merely for simple Bukkit data classes.

📍 Affects 3 files
  • src/test/java/us/eunoians/mcrpg/quest/chain/availability/WindowBoundaryTypeRegistryTest.java#L20-L23 (this comment)
  • src/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/FixedWindowBoundaryTypeTest.java#L22-L24
  • src/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/RecurringWindowBoundaryTypeTest.java#L23-L24
🤖 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/chain/availability/WindowBoundaryTypeRegistryTest.java`
around lines 20 - 23, Convert the three listed test classes to plain JUnit tests
by removing McRPGBaseTest inheritance and its import from
WindowBoundaryTypeRegistryTest.java (lines 20-23),
FixedWindowBoundaryTypeTest.java (lines 22-24), and
RecurringWindowBoundaryTypeTest.java (lines 23-24); leave their test behavior
unchanged.

Sources: Coding guidelines, Learnings

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