Skip to content

Fix vanilla nether/end tests to correctly exercise early-return path in onPlayerLeaveIsland#166

Merged
tastybento merged 3 commits intodevelopfrom
copilot/sub-pr-164-again
Mar 8, 2026
Merged

Fix vanilla nether/end tests to correctly exercise early-return path in onPlayerLeaveIsland#166
tastybento merged 3 commits intodevelopfrom
copilot/sub-pr-164-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 8, 2026

testOnPlayerLeaveIslandVanillaNether and testOnPlayerLeaveIslandVanillaEnd claimed to verify that movement in vanilla (non-island) worlds is ignored, but both asserted assertTrue(event.isCancelled()) — the opposite behavior. Since addon.inGameWorld was never overridden from the default true, the guard at line 292 never triggered and the tests were silently exercising the teleport-back path instead.

Changes

  • Both vanilla world tests: replace stale iwm.isIslandNether/End + island.onIsland stubs with when(addon.inGameWorld(any())).thenReturn(false) and assert verify(addon, never()).getIslands() — consistent with the existing testOnPlayerLeaveIslandReturnTeleportOutsideCheckNotInGameWorld
  • PlayerListener: fix grammar in debug log ("did not found""did not find")
// Before — wrong: doesn't override inGameWorld, asserts teleport DID happen
when(iwm.isIslandNether(any())).thenReturn(false);
when(iwm.isIslandEnd(any())).thenReturn(false);
when(island.onIsland(any())).thenReturn(false);
...
assertTrue(event.isCancelled());  // contradicts the javadoc

// After — correct: vanilla world is not a game world, early return fires
when(addon.inGameWorld(any())).thenReturn(false);
...
verify(addon, never()).getIslands();

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…return for vanilla worlds

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback from PR #164 for Release 4.8.1 Fix vanilla nether/end tests to correctly exercise early-return path in onPlayerLeaveIsland Mar 8, 2026
@tastybento tastybento marked this pull request as ready for review March 8, 2026 01:10
@tastybento tastybento merged commit 5d0e9d5 into develop Mar 8, 2026
1 check failed
@tastybento tastybento deleted the copilot/sub-pr-164-again branch March 8, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants