[Unit Tests] Add tests for quest chain events and LocaleSetting#307
[Unit Tests] Add tests for quest chain events and LocaleSetting#307DiamondDagger590 wants to merge 1 commit into
Conversation
Cover 6 previously untested/undertested classes: - QuestChainFailEvent (non-cancellable chain failure event) - QuestChainExpireEvent (cancellable event with Optional<Player>) - QuestChainRestartEvent (non-cancellable with RestartReason enum) - QuestChainStepRetryEvent (retry tracking with step/retryNumber/maxRetries) - QuestChainAbandonEvent (non-cancellable chain abandon event) - LocaleSetting (enum fromString, getSettingKey, enum values) ~37 test executions covering constructor getters, null/offline player paths, HandlerList conformance, cancellation toggle, and parameterized enum coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G8PV45naRjtoHhr7ecZKVW
WalkthroughAdds JUnit 5 coverage for quest-chain events and ChangesQuest-chain event tests
Locale setting tests
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 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 |
Extensibility ReviewBreaking change risk: NONE — This diff contains only test classes; no production API surface is modified. After reviewing all five new files in this diff, every changed file is located under No extensibility concerns found. The test code is, however, indirectly informative to addon developers in two ways worth noting (these are observations, not actionable concerns):
No production interfaces, abstract classes, registries, NamespacedKey constants, or |
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/setting/impl/LocaleSettingTest.java`:
- Around line 8-19: Convert LocaleSettingTest from extending McRPGBaseTest to a
plain JUnit test by removing the McRPGBaseTest import and inheritance. Preserve
its existing test methods and assertions 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: 7ff6b6cc-04ba-4feb-8388-4bab549c9f7b
📒 Files selected for processing (6)
src/test/java/us/eunoians/mcrpg/event/quest/chain/QuestChainAbandonEventTest.javasrc/test/java/us/eunoians/mcrpg/event/quest/chain/QuestChainExpireEventTest.javasrc/test/java/us/eunoians/mcrpg/event/quest/chain/QuestChainFailEventTest.javasrc/test/java/us/eunoians/mcrpg/event/quest/chain/QuestChainRestartEventTest.javasrc/test/java/us/eunoians/mcrpg/event/quest/chain/QuestChainStepRetryEventTest.javasrc/test/java/us/eunoians/mcrpg/setting/impl/LocaleSettingTest.java
| import us.eunoians.mcrpg.McRPGBaseTest; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertFalse; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
|
||
| /** | ||
| * Tests for {@link LocaleSetting}. | ||
| */ | ||
| public class LocaleSettingTest extends McRPGBaseTest { |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
Convert to a plain JUnit test.
This test class does not use MockBukkit server interaction or McRPGPlayer tracking. As per coding guidelines, a test that extends McRPGBaseTest but uses neither of these should be converted to a plain JUnit test.
♻️ Proposed refactor
-import us.eunoians.mcrpg.McRPGBaseTest;
-
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests for {`@link` LocaleSetting}.
*/
-public class LocaleSettingTest extends McRPGBaseTest {
+public class LocaleSettingTest {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import us.eunoians.mcrpg.McRPGBaseTest; | |
| import java.util.Optional; | |
| import static org.junit.jupiter.api.Assertions.assertEquals; | |
| import static org.junit.jupiter.api.Assertions.assertFalse; | |
| import static org.junit.jupiter.api.Assertions.assertTrue; | |
| /** | |
| * Tests for {@link LocaleSetting}. | |
| */ | |
| public class LocaleSettingTest extends McRPGBaseTest { | |
| import java.util.Optional; | |
| import static org.junit.jupiter.api.Assertions.assertEquals; | |
| import static org.junit.jupiter.api.Assertions.assertFalse; | |
| import static org.junit.jupiter.api.Assertions.assertTrue; | |
| /** | |
| * Tests for {`@link` LocaleSetting}. | |
| */ | |
| public class LocaleSettingTest { |
🤖 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/setting/impl/LocaleSettingTest.java` around
lines 8 - 19, Convert LocaleSettingTest from extending McRPGBaseTest to a plain
JUnit test by removing the McRPGBaseTest import and inheritance. Preserve its
existing test methods and assertions unchanged.
Source: Coding guidelines
Summary
QuestChainFailEvent,QuestChainExpireEvent,QuestChainRestartEvent,QuestChainStepRetryEvent,QuestChainAbandonEventLocaleSettingenum (previously at 13% coverage with no direct test class)Classes Covered
QuestChainFailEventQuestChainExpireEventQuestChainRestartEventQuestChainStepRetryEventQuestChainAbandonEventLocaleSettingTest plan
QuestRewardDistributionResolverPotBehaviorTest)🤖 Generated with Claude Code
https://claude.ai/code/session_01G8PV45naRjtoHhr7ecZKVW
Generated by Claude Code
Summary by CodeRabbit