[Unit Tests] Add window boundary type and registry tests, extend scope tests - #335
[Unit Tests] Add window boundary type and registry tests, extend scope tests#335DiamondDagger590 wants to merge 1 commit into
Conversation
…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
|
Claude finished @DiamondDagger590's task in 1m 4s —— View job Claude PR Review — In Progress
|
📝 WalkthroughWalkthroughThe pull request adds JUnit coverage for window boundary registration and parsing. It also reorganizes and expands ChangesQuest 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.
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
📒 Files selected for processing (4)
src/test/java/us/eunoians/mcrpg/quest/chain/availability/WindowBoundaryTypeRegistryTest.javasrc/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/FixedWindowBoundaryTypeTest.javasrc/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/RecurringWindowBoundaryTypeTest.javasrc/test/java/us/eunoians/mcrpg/quest/impl/scope/impl/SinglePlayerQuestScopeTest.java
| @DisplayName("WindowBoundaryTypeRegistry") | ||
| class WindowBoundaryTypeRegistryTest extends McRPGBaseTest { | ||
|
|
||
| private static final NamespacedKey TEST_KEY = new NamespacedKey("mcrpg", "test_boundary"); |
There was a problem hiding this comment.
📐 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: Removeextends McRPGBaseTestand its import.src/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/FixedWindowBoundaryTypeTest.java#L22-L24: Removeextends McRPGBaseTestand its import.src/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/RecurringWindowBoundaryTypeTest.java#L23-L24: Removeextends McRPGBaseTestand 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-L24src/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

Summary
FixedWindowBoundaryTypeTest(5 tests): coversparse()with valid ISO-8601 dates, null fields, invalid formats, and partial date formatsRecurringWindowBoundaryTypeTest(7 tests): coversparse()with valid month-day/time, null fields (individual and both), invalid formats, and time without secondsWindowBoundaryTypeRegistryTest(7 tests): coversregister,registeredcheck,getby key, unknown key, same-key replacement, and multi-type lookupSinglePlayerQuestScopeTest(5 new tests): add@Nestedgrouping, add tests forgetScopeKey(),getQuestUUID(),isPlayerInScopewhen no player set,saveScopeinvalid state throws, andgetPlayerInScopeafter setCoverage impact
FixedWindowBoundaryTypeRecurringWindowBoundaryTypeWindowBoundaryTypeRegistrySinglePlayerQuestScopegetScopeKey,getQuestUUID,isPlayerInScopenull path,saveScopeguard)All 24 new/modified tests pass. Full test suite passes with zero failures (
./gradlew test).Test plan
Generated by Claude Code
Summary by CodeRabbit