You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: retain mock world for command locations - #20
Fixes an intermittent World unloaded error in CommandAndResourceTest that failed the first v3.2.0 release attempt (the rerun passed).
Paper's Location holds its world in a WeakReference and getWorld() throws once it clears. The test kept its mock World only in a @BeforeEach local variable, so the garbage collector could collect it before createresource called Location.getChunk(). The mock is now retained in a field for the test instance's lifetime. Production code is unchanged: a live server holds real worlds strongly.
Validation: tfmc-mvn -o -B -Dtest=CommandAndResourceTest test — 5 tests pass. After this merges, Dowsing will be released as v3.2.1 and the unpublished v3.2.0 draft/tag removed.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
📝 Summary
Summary by CodeRabbit
Tests
Updated test setup to retain a reference to the mocked world; existing world and player behaviour is unchanged.
Walkthrough
The test class now stores its mocked World in a field. The setup continues to create and stub the mocked world and chunk.
Changes
Test fixture
Layer / File(s)
Summary
Store the mocked world in the test fixture src/test/java/net/tfminecraft/dowsing/managers/CommandAndResourceTest.java
The setup assigns the mocked World to a test-class field instead of a local variable. Existing world and chunk stubbing remains unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:XS0-9 effective changed lines (tests excluded in mixed PRs).
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes an intermittent
World unloadederror inCommandAndResourceTestthat failed the first v3.2.0 release attempt (the rerun passed).Paper's
Locationholds its world in aWeakReferenceandgetWorld()throws once it clears. The test kept its mockWorldonly in a@BeforeEachlocal variable, so the garbage collector could collect it beforecreateresourcecalledLocation.getChunk(). The mock is now retained in a field for the test instance's lifetime. Production code is unchanged: a live server holds real worlds strongly.Validation:
tfmc-mvn -o -B -Dtest=CommandAndResourceTest test— 5 tests pass. After this merges, Dowsing will be released as v3.2.1 and the unpublished v3.2.0 draft/tag removed.