Add JUnit5 tests for DefaultPasteUtil#2833
Merged
tastybento merged 1 commit intodevelopfrom Mar 8, 2026
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Summary
DefaultPasteUtilcovering all public and package-private methodsCommonTestSetuppattern used throughout the projectTest coverage
createBlockData— success and fallback toconvertBlockDataon exceptionconvertBlockData— AIR fallback for unknown blocks,sign→oak_signandwall_sign→oak_wall_signlegacy conversions,IllegalArgumentExceptionlogs warningssetBlock— async completion viaUtil.getChunkAtAsync, biome set/skipsetSpawner— all seven spawner fields plusupdate()setBlockState— InventoryHolder, CreatureSpawner, Banner (patterns present/null), Sign (writeSign called per side), ItemsAdder hook lookup, generic state no-opsetEntity— entity spawn and empty-list no-opspawnBlueprintEntity— null type, Bukkit entity spawn +configureEntity, custom name with owner placeholder, null island, MythicMobs hook absent fallthroughwriteSign— normal paste, SPAWN_HERE (AIR/WATER + spawn point), SPAWN_HERE on back side ignored, null island, START_TEXT locale queries, START_TEXT null owner, WallSign facingNotable implementation detail
DefaultPasteUtilstoresBentoBox.getInstance()in aprivate static finalfield at class-load time. Mockito 5's inline mock maker clears mock instrumentation between tests viaclearInlineMocks(), de-stubbing that captured mock. The test class usessun.misc.Unsafe.putObject()in@BeforeEachto re-inject the current test's plugin mock into the final field before each test.Test plan
./gradlew test --tests "world.bentobox.bentobox.util.DefaultPasteUtilTest")🤖 Generated with Claude Code