[Tests] Add unit tests for ManagerRegistry, PluginHookRegistry, TimeProvider, DriverRegistry#24
Conversation
…rovider, DatabaseDriverType, DriverRegistry Add 42 new tests across 5 test classes covering core registry and utility infrastructure: - ManagerRegistryTest (11 tests): register, duplicate detection, registered checks by instance and key, manager retrieval, subclass lookup support - PluginHookRegistryTest (11 tests): register, duplicate detection, pluginHook by key, pluginHooks by extensible interface filtering, mixed-hook queries - TimeProviderTest (7 tests): fixed clock instant, zone-adjusted local datetime, clock accessor - DatabaseDriverTypeTest (7 tests): driver name, fromString with case variations, empty/invalid input, values enumeration - DriverRegistryTest (8 tests): register with tryDriver validation, registered by instance and driver type, getDriver by type Also fixes two pre-existing compilation/test failures: - ChainComparatorTest: Add explicit type witnesses for Comparator.naturalOrder() and Comparator.reverseOrder() to satisfy ChainComparator generic inference - ParserTest: Fix function-without-parenthesis test to use "sin" instead of "sin 5" (spaces are stripped, making "sin5" a variable, not a function call) Package coverage improvements: - registry/manager: 8.6% -> 74.3% - database/driver: 0% -> 73.9% - registry/plugin: 11.1% -> 66.7% https://claude.ai/code/session_01N7Qpd7kWuEaSXAvFgGJhCa
|
Warning Review limit reached
More reviews will be available in 48 minutes and 44 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis pull request expands test coverage across registry, utility, and parser components while refining testing personas and guidelines. The changes add five new test classes and enhance existing tests, with documentation updates to clarify testing patterns around boundary values, MockBukkit player setup, and test quality expectations. ChangesTest Coverage Expansion and Testing Guidance Refinement
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Extensibility ReviewBreaking change risk: NONE — this diff contains only test code additions and minor test-code fixes with no changes to production source files. All modified and added files reside exclusively under Specific observations:
No extensibility concerns found. |
Testing ReviewI'll systematically apply every checklist item to the diff. AnalysisProduction Files ChangedThe diff contains only test files and one test-fixture helper ( FindingsCONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: SummaryProduction files changed: None (all changes are in test files) Test files present:
Coverage gaps:
|
Security ReviewNo security concerns found. The diff contains exclusively test code additions and minor test corrections (a |
- Fix brittle enum-size assertion in DatabaseDriverTypeTest.values_containsSqlite to use Arrays.asList().contains() instead of hardcoding array length - Add test for "sin 5" parser edge case documenting that spaces are stripped, causing "sin5" to be treated as a variable (returns 0.0) rather than a function-missing-parens error https://claude.ai/code/session_01N7Qpd7kWuEaSXAvFgGJhCa
Addressing Testing Review FeedbackActionable items fixed in b03301e: Fixed:
Not changed (by design):
Generated by Claude Code |
Extensibility ReviewBreaking change risk: NONE — this diff contains only test code additions and minor test-internal refactors with no changes to production source files. All modified and added files reside exclusively under No extensibility concerns found. |
Testing ReviewTesting Audit Report — McCoreCONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: The CONCERN: No test covers the SummaryProduction files changed: Test files present: Coverage gaps:
|
Security ReviewNo security concerns found. The diff contains exclusively test code additions and minor test corrections (a |
Port applicable improvements from McRPG's persona-testing.mdc: - Add config-driven values edge case check for ReloadableContent - Add server.addPlayer() vs bare PlayerMock check for join-event tests - Align method naming convention with CLAUDE.md (methodUnderTest_expectedOutcome_whenCondition) - Add note that _whenCondition suffix is optional when context is obvious - Enumerate common assertion methods in test quality check - Improve Bukkit-dependent separation wording with nuanced applicability note - Add concrete examples to naming and DisplayName checklist items Skipped McRPG-specific items: McRPGBaseTest, ability components, TestBootstrap spy'd TimeProvider, BaseAbilityTest references. https://claude.ai/code/session_01N7Qpd7kWuEaSXAvFgGJhCa
Extensibility ReviewBreaking change risk: NONE — This diff contains only test files and AI-assistant prompt/rule documentation; no production source files are modified. Reviewing against each checklist category: Public interfaces / abstract classes / method signatures: No production code is touched. All changes are confined to GUI framework ( Database framework ( Registry and extension points (
McCore plugin-agnostic rule: The test helpers ( Minor observation (non-breaking, informational only): CONCERN: CONCERN: No extensibility concerns found for the production framework contract. All findings above are test-quality observations only. |
Testing ReviewTesting Audit ReportProduction files changed:
New test files added:
CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: The SummaryProduction files changed: Test files present: Coverage gaps:
|
Security ReviewNo security concerns found. The diff contains exclusively test infrastructure and test case changes: new unit tests for |
Verifies that registering a second driver for the same DatabaseDriverType silently overwrites the first (unlike ManagerRegistry which throws). https://claude.ai/code/session_01N7Qpd7kWuEaSXAvFgGJhCa
Extensibility ReviewBreaking change risk: NONE — this diff contains only test code, documentation rule updates, and a test behavior fix; no production source files are modified. The diff touches:
None of these files are part of McCore's public API surface. No production classes, interfaces, abstract classes, method signatures, registry constants, or Javadoc contracts are changed. There is nothing for a downstream plugin to compile against differently, and no extension points are added or removed. That said, two findings within the test code itself are worth flagging for correctness, since test infrastructure in CONCERN: CONCERN: No other extensibility concerns found. The |
Testing ReviewAudit ReportProduction files changed: Test files present:
Coverage gaps: See concerns below. CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: Neither CONCERN: The |
Security ReviewNo security concerns found. The diff contains exclusively test infrastructure changes, documentation/persona-prompt updates, and a parser test behavioral correction. No production DAO methods, |
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/com/diamonddagger590/mccore/registry/plugin/PluginHookRegistryTest.java`:
- Line 22: Rename the test interface MarkerHookInterface to follow the Hook
suffix convention (e.g., MarkerHook) and update all references in
PluginHookRegistryTest accordingly; specifically, change the interface name
MarkerHookInterface to MarkerHook and adjust any usages, imports, or type
references within the class/methods in PluginHookRegistryTest so the test
compiles and follows the project's plugin hook naming rule.
🪄 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: 8b919128-a6bf-4e89-b4bb-17630d02b589
📒 Files selected for processing (9)
.claude/commands/review-testing.md.cursor/rules/persona-testing.mdcsrc/test/java/com/diamonddagger590/mccore/database/driver/DatabaseDriverTypeTest.javasrc/test/java/com/diamonddagger590/mccore/database/driver/DriverRegistryTest.javasrc/test/java/com/diamonddagger590/mccore/parser/ParserTest.javasrc/test/java/com/diamonddagger590/mccore/registry/manager/ManagerRegistryTest.javasrc/test/java/com/diamonddagger590/mccore/registry/plugin/PluginHookRegistryTest.javasrc/test/java/com/diamonddagger590/mccore/util/TimeProviderTest.javasrc/test/java/com/diamonddagger590/mccore/util/comparator/ChainComparatorTest.java
|
|
||
| class PluginHookRegistryTest { | ||
|
|
||
| private interface MarkerHookInterface {} |
There was a problem hiding this comment.
Rename test interface to follow Hook suffix convention.
MarkerHookInterface should use the Hook suffix (e.g., MarkerHook) to stay consistent with McCore naming rules for plugin hook interfaces.
As per coding guidelines: "Use Hook suffix for plugin hook interfaces (e.g., AfkPluginHook, CoreCitizensHook)."
🤖 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/com/diamonddagger590/mccore/registry/plugin/PluginHookRegistryTest.java`
at line 22, Rename the test interface MarkerHookInterface to follow the Hook
suffix convention (e.g., MarkerHook) and update all references in
PluginHookRegistryTest accordingly; specifically, change the interface name
MarkerHookInterface to MarkerHook and adjust any usages, imports, or type
references within the class/methods in PluginHookRegistryTest so the test
compiles and follows the project's plugin hook naming rule.
TimeProvider is accessed via CorePlugin.getInstance().getTimeProvider() in production, where CorePlugin holds a static singleton. Add registry reset in @BeforeEach/@AfterEach to establish the cleanup pattern and guard against future tests in this class that may interact with the CorePlugin singleton. https://claude.ai/code/session_01N7Qpd7kWuEaSXAvFgGJhCa
Addressing remaining testing review feedbackFixed in 89d252d:
Fixed in 04a9247:
Remaining concerns — not changed (by design):
Generated by Claude Code |
Extensibility ReviewBreaking change risk: NONE — this diff contains only test files, test-support tooling, and documentation updates with no changes to production source. No extensibility concerns found. Rationale: Every changed file falls into one of three categories that are out of scope for the extensibility checklist:
No public interfaces were added or changed, no abstract methods were introduced, no method signatures were altered, no constants were renamed, no |
Testing ReviewTesting Audit ReportProduction files changed:
Test files present:
Coverage gaps:
ConcernsCONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: CONCERN: The CONCERN: CONCERN: No test covers the Production files changed: Test files present: Coverage gaps: |
Security ReviewNo security concerns found. The diff contains exclusively test infrastructure and documentation changes: new JUnit 5 test classes ( None of the changed files touch DAO query construction, |
Summary
registeredchecks by instance andManagerKey, manager retrieval by key, subclass lookup support (the special-casing for generic managers likeGuiManager/PlayerManager), and null return for unregistered keys.registeredchecks,pluginHookby key returningOptional,pluginHooksfiltering by extensible interface class (e.g.CustomBlockHook), mixed-hook queries, and empty registry behavior.now()with fixed clock, repeated calls returning same instant,nowLocal()with UTC/positive/negative zone offsets, andclock()accessor.getDriverName(),fromString()with exact/case-insensitive/mixed-case matching, invalid/empty input returning emptyOptional, andvalues()enumeration.registerwithtryDrivervalidation (success and failure),registeredby instance,isDriverRegisteredbyDatabaseDriverType,getDriverreturningOptionalfor registered/unregistered types.Also fixes two pre-existing compilation/test failures:
Comparator.<Integer>naturalOrder()/reverseOrder()) to satisfyChainComparatorgeneric inference with varargs constructor"sin 5"to"sin"— spaces are stripped by the parser, so"sin5"is treated as a variable name rather than a function callCoverage improvements
registry/managerdatabase/driverregistry/pluginAll 42 new tests target pure-Java classes with zero MockBukkit or server mock required. All tests use Given/When/Then
@DisplayNameannotations.Test plan
./gradlew testpasses with all 216 tests green (174 existing + 42 new)./gradlew shadowJarbuilds successfullyhttps://claude.ai/code/session_01N7Qpd7kWuEaSXAvFgGJhCa
Generated by Claude Code
Summary by CodeRabbit
Release Notes
Tests
Documentation