Skip to content

Add JUnit5 tests for ClosestSafeSpotTeleport#2828

Merged
tastybento merged 1 commit intodevelopfrom
worktree-closest-safe-spot-teleport
Mar 4, 2026
Merged

Add JUnit5 tests for ClosestSafeSpotTeleport#2828
tastybento merged 1 commit intodevelopfrom
worktree-closest-safe-spot-teleport

Conversation

@tastybento
Copy link
Member

Summary

  • Adds ClosestSafeSpotTeleportTest with 36 tests covering all package-private methods of ClosestSafeSpotTeleport
  • Extends CommonTestSetup; stubs Util.getChunkAtAsync with a never-completing future so tests control async flow explicitly
  • Uses reflection helpers to inject internal state (block queue, task ref, flags) for fine-grained unit testing

Test plan

  • Builder validation (null entity / location / world → null + logError; valid build; portal flag; success runnable)
  • checkLocation() fast-path vs full scan branching
  • getChunksToScan() returns non-empty, duplicate-free list
  • addChunk() island space filtering and duplicate prevention
  • checkPosition() portal and non-portal modes, noPortalPosition handling
  • scanBlockQueue() empty and non-empty cases
  • scanAndPopulateBlockQueue() bounding-box filtering
  • makeAndTeleport() correct material placed per environment
  • gatherChunks() checking-flag guard, exhausted iterator, early-finish on close candidate
  • finishTask() task cancellation, success path, portal fallback, cancelIfFail path
  • asyncTeleport() success runnable dispatch and future completion
  • All 36 tests pass (./gradlew test --tests "world.bentobox.bentobox.util.teleport.ClosestSafeSpotTeleportTest")

🤖 Generated with Claude Code

36 tests covering the Builder, checkLocation(), getChunksToScan(),
addChunk(), checkPosition(), scanBlockQueue(), scanAndPopulateBlockQueue(),
makeAndTeleport(), gatherChunks(), finishTask(), and asyncTeleport().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 4, 2026

@tastybento tastybento merged commit 02693d0 into develop Mar 4, 2026
3 checks passed
@tastybento tastybento deleted the worktree-closest-safe-spot-teleport branch March 4, 2026 06: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.

1 participant