Skip to content

Implement comprehensive BlueprintPasterTest suite#2829

Merged
tastybento merged 2 commits intodevelopfrom
worktree-blueprint-paster
Mar 4, 2026
Merged

Implement comprehensive BlueprintPasterTest suite#2829
tastybento merged 2 commits intodevelopfrom
worktree-blueprint-paster

Conversation

@tastybento
Copy link
Member

Summary

  • Replace 4 @Disabled("NMS Cannot be tested") placeholder tests with 25 real JUnit 5 tests
  • Mock NMS by intercepting Util.getPasteHandler() via mockedUtil and new PasteHandlerImpl() via Mockito.mockConstruction
  • Drive the BlueprintPaster state machine manually using a captured Runnable from the scheduler

Key fix

PasteHandler has a static initializer BlockData AIR_BLOCKDATA = Bukkit.createBlockData(Material.AIR). Since MockitoAnnotations.openMocks() runs before MockBukkit.mock() in CommonTestSetup, @Mock PasteHandler would fail with ExceptionInInitializerError. The fix is to create the mock manually after super.setUp().

Test coverage

Category Tests
Constructors clipboard, island, bedrock offset, Y clamping (max/min)
paste() basics returns future, schedules timer, useNMS=false, owner messages, no-owner, null maps
State machine all 7 states including overworld/nether/end dimension-done messages
Block/entity pasting NMS paster vs fallback, entities message
Sink blueprint getHighestBlockYAt() called when isSink() is true

Test plan

  • ./gradlew test --tests "world.bentobox.bentobox.blueprints.BlueprintPasterTest" — 25/25 pass
  • ./gradlew test — full suite passes

🤖 Generated with Claude Code

tastybento and others added 2 commits March 3, 2026 22:26
Replace 4 @disabled placeholder tests with 25 real JUnit 5 tests covering
all state machine transitions, constructor variants, NMS mocking via
mockConstruction/mockedUtil, and message verification.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 4, 2026

@tastybento tastybento merged commit 06e9543 into develop Mar 4, 2026
3 checks passed
@tastybento tastybento deleted the worktree-blueprint-paster branch March 4, 2026 06:42
@tastybento tastybento restored the worktree-blueprint-paster branch March 8, 2026 23:07
@tastybento tastybento deleted the worktree-blueprint-paster branch March 8, 2026 23:32
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