From eca54346984bbe2405a3900616f549e72a2a92b4 Mon Sep 17 00:00:00 2001 From: Jeffrey Date: Wed, 17 Jan 2024 16:53:51 +0100 Subject: [PATCH] test this behaviour --- .../listeners/TestSlimefunItemInteractListener.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSlimefunItemInteractListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSlimefunItemInteractListener.java index 08b506e8c6..cc33e3750a 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSlimefunItemInteractListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSlimefunItemInteractListener.java @@ -116,7 +116,9 @@ void testCannotOpenInvOfBrokenBlock() { // TODO: Create an event for open inventory so this isn't guess work Assertions.assertTrue(BlockMenuPreset.isInventory(electricFurnace.getId())); Assertions.assertTrue(BlockStorage.getStorage(block.getWorld()).hasInventory(block.getLocation())); - // TODO(future): Check viewers - MockBukkit does not implement this today + + // Assert player has the inventory open + Assertions.assertEquals(1, BlockStorage.getInventory(block).toInventory().getViewers().size()); // Break the block BlockBreakEvent blockBreakEvent = new BlockBreakEvent(block, player); @@ -129,6 +131,9 @@ void testCannotOpenInvOfBrokenBlock() { // Assert the block is queued for removal Assertions.assertTrue(Slimefun.getTickerTask().isDeletedSoon(block.getLocation())); + // Assert that the inventory was closed + Assertions.assertEquals(0, BlockStorage.getInventory(block).toInventory().getViewers().size()); + // Clear event queue since we'll be running duplicate events server.getPluginManager().clearEvents();