### Question:
MultiPageGui implements GUI { @Override public void removeItem(int slot, int page) { Inventory inventory = inventoryPages.getPage(page); inventory.removeItem(inventory.getItem(slot)); slotActions.removeSlotAction(page, slot); if (inventory.getContents().length == 0 && !inventoryPages.isEmpty()) { inventoryPages.removePage(page); slotActions.shiftAfterPageRemoval(page); playerPageRearranger.rearrangeAfterRemoval(page); } }  @Override void displayTo(Player player); @Override void clear(); @Override void addButton(InventoryItem inventoryItem, Executable executable); @Override void addItem(InventoryItem item); @Override void removeItem(int slot, int page);  }### Answer:
@Test public void removeItem() { MultiPageGui multiPageGui = new MultiPageGui(mock(PlayerPages.class), inventoryPages, slotActions, server, playerPageRearranger); Inventory firstPage = mock(Inventory.class); Inventory secondPage = mock(Inventory.class); InventoryItem firstPageItem = makeItem(1, 2); InventoryItem secondPageItem = makeItem(2, 3); when(inventoryPages.getPage(eq(1))).thenReturn(firstPage); when(inventoryPages.getPage(eq(2))).thenReturn(secondPage); multiPageGui.addItem(firstPageItem); multiPageGui.addItem(secondPageItem); when(secondPage.getContents()).thenReturn(new ItemStack[0]); when(inventoryPages.isEmpty()).thenReturn(false); multiPageGui.removeItem(secondPageItem.getSlot(), secondPageItem.getPage()); when(playerPages.getActiveSessions()).thenReturn(Collections.singleton(UUID.randomUUID())); Player player = mock(Player.class); when(server.getPlayer(any(UUID.class))).thenReturn(player); verify(slotActions).shiftAfterPageRemoval(eq(2)); verify(playerPageRearranger).rearrangeAfterRemoval(eq(2)); }