Skip to content

Commit 74d9487

Browse files
tastybentoclaude
andcommitted
Fix CI: initialize MockBukkit in InventoryStorageTest
Paper API 1.21.11 routes ItemStack constructors through ItemStack.of() which requires Bukkit.server to be set. InventoryStorageTest was creating ItemStack objects without MockBukkit initialization, causing class init failure that cascaded to all other test classes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 94f944e commit 74d9487

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/test/java/com/wasteofplastic/invswitcher/dataobjects/InventoryStorageTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
import org.bukkit.Statistic;
1717
import org.bukkit.entity.EntityType;
1818
import org.bukkit.inventory.ItemStack;
19+
import org.junit.jupiter.api.AfterEach;
1920
import org.junit.jupiter.api.BeforeEach;
2021
import org.junit.jupiter.api.Test;
2122
import org.junit.jupiter.api.extension.ExtendWith;
2223
import org.mockito.junit.jupiter.MockitoExtension;
24+
import org.mockbukkit.mockbukkit.MockBukkit;
2325

2426
/**
2527
* @author tastybentos
@@ -35,9 +37,15 @@ public class InventoryStorageTest {
3537
*/
3638
@BeforeEach
3739
public void setUp() {
40+
MockBukkit.mock();
3841
is = new InventoryStorage();
3942
}
4043

44+
@AfterEach
45+
public void tearDown() {
46+
MockBukkit.unmock();
47+
}
48+
4149
/**
4250
* Test method for {@link com.wasteofplastic.invswitcher.dataobjects.InventoryStorage#getUniqueId()}.
4351
*/

0 commit comments

Comments
 (0)