[Unit Tests] Add tests for TimeGate conditions and WindowBoundary types - #329
[Unit Tests] Add tests for TimeGate conditions and WindowBoundary types#329DiamondDagger590 wants to merge 2 commits into
Conversation
Cover four previously untested classes: - TimeGateCondition: evaluate() boundary logic with timezone handling - TimeGateChainConditionType: parse() with valid/invalid YAML sections - FixedWindowBoundaryType: parse() for one-time date boundaries - RecurringWindowBoundaryType: parse() for yearly recurring boundaries Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SYePW1DMHxkp5NZJ6F7bB8
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SYePW1DMHxkp5NZJ6F7bB8
|
Claude finished @DiamondDagger590's task in 2m 47s —— View job Review complete — 0 important, 1 nitScope: This PR adds unit tests only ( I verified the new assertions against the actual source ( Nits (1)
No blocking issues — coverage looks thorough (boundary edge cases, timezone handling, missing/invalid field parsing, and logger warning verification are all exercised). |
📝 WalkthroughWalkthroughAdded JUnit coverage for fixed and recurring window boundaries and for time-gate parsing and evaluation. The tests verify metadata, valid and invalid inputs, timezone behavior, boundary comparisons, empty results, and warning logs. ChangesQuest chain time behavior
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/quest/chain/availability/builtin/WindowBoundaryTypeTest.java-70-72 (1)
70-72: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winGuard the remaining direct casts with concrete-type assertions.
Add
assertInstanceOf(..., result.get())before the casts inWindowBoundaryTypeTestfor the Fixed and Recurring tests that parse date/time components, and inTimeGateChainConditionTypeTestfor the preserve-time-component test. This keeps the casts aligned with the casting guideline.🤖 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/builtin/WindowBoundaryTypeTest.java` around lines 70 - 72, Add assertInstanceOf guard assertions before the direct casts to ensure type safety in tests. In WindowBoundaryTypeTest.java around lines 70-72, add an assertInstanceOf check for WindowBoundary.Fixed before the cast to fixed. In WindowBoundaryTypeTest.java around lines 166-169, add an assertInstanceOf check for WindowBoundary.Recurring before the cast to recurring. In TimeGateChainConditionTypeTest.java around lines 121-126, add an assertInstanceOf check for the appropriate type before the cast in the preserve-time-component test. Each assertInstanceOf should verify the type of result.get() and be placed immediately before the corresponding cast to maintain consistency with the casting guideline.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/quest/chain/availability/builtin/WindowBoundaryTypeTest.java`:
- Around line 70-72: Add assertInstanceOf guard assertions before the direct
casts to ensure type safety in tests. In WindowBoundaryTypeTest.java around
lines 70-72, add an assertInstanceOf check for WindowBoundary.Fixed before the
cast to fixed. In WindowBoundaryTypeTest.java around lines 166-169, add an
assertInstanceOf check for WindowBoundary.Recurring before the cast to
recurring. In TimeGateChainConditionTypeTest.java around lines 121-126, add an
assertInstanceOf check for the appropriate type before the cast in the
preserve-time-component test. Each assertInstanceOf should verify the type of
result.get() and be placed immediately before the corresponding cast to maintain
consistency with the casting guideline.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: QUIET
Plan: Pro Plus
Run ID: 24a94095-56d8-4ca1-adfc-2c7d9eef694d
📒 Files selected for processing (3)
src/test/java/us/eunoians/mcrpg/quest/chain/availability/builtin/WindowBoundaryTypeTest.javasrc/test/java/us/eunoians/mcrpg/quest/chain/condition/builtin/TimeGateChainConditionTypeTest.javasrc/test/java/us/eunoians/mcrpg/quest/chain/condition/builtin/TimeGateConditionTest.java
Summary
TimeGateConditionandTimeGateChainConditionType(quest chain start condition system) — both previously at 0% coverageFixedWindowBoundaryTypeandRecurringWindowBoundaryType(availability window boundary parsing) — both previously at 0% coverageSectionfor YAML parsing)Classes covered
TimeGateConditionTimeGateChainConditionTypeafter, invalid date format, invalid timezone, default timezoneFixedWindowBoundaryTypeRecurringWindowBoundaryTypeTest plan
./gradlew test— BUILD SUCCESSFUL)WindowBoundaryrecords but not the boundary type parsers; [Unit Tests] Add tests for quest chain events and LocaleSetting #307/[Unit Tests] Add coverage for event classes: ability cooldown, quest cancel/reward, chain lifecycle #328 cover chain events, not conditions)Generated by Claude Code
Summary by CodeRabbit