Skip to content

Commit

Permalink
Added getCursor invocation for InventoryView mock
Browse files Browse the repository at this point in the history
  • Loading branch information
fulminazzo committed Apr 8, 2024
1 parent 9a3a60a commit e41f7a9
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@ void simulateInventoryClick(InventoryClickEvent event) {
assertFalse(this.clicked, "Clicked should be initialized as false");
assertFalse(event.isCancelled(), "Event should not be cancelled");
listener.on(event);
System.out.println("cancelled ? " + event.isCancelled());
assertTrue(event.isCancelled(), "Event should have been cancelled by now");
assertTrue(this.clicked, "Clicked should have changed");
}

@Test
void testMovableItem() {
PersistentItem persistentItem = new PersistentItem(Material.DIAMOND).setMobility(Mobility.INTERNAL);
PersistentItem persistentItem = new PersistentItem(Material.DIAMOND_PICKAXE).setMobility(Mobility.INTERNAL);
InventoryView view = setupInventoryClickEventView();
int slot = view.getTopInventory().getSize();
view.getBottomInventory().setItem(0, persistentItem.create());
Expand Down Expand Up @@ -244,6 +245,7 @@ private static InventoryView getInventoryView(Player player, Inventory inventory
when(player.getOpenInventory()).thenReturn(view);
when(view.getPlayer()).thenReturn(player);
when(view.getItem(any(int.class))).thenCallRealMethod();
when(view.getCursor()).thenCallRealMethod();
when(view.convertSlot(any(int.class))).thenCallRealMethod();
when(view.getInventory(any(int.class))).thenAnswer(a -> {
int slot = a.getArgument(0);
Expand Down

0 comments on commit e41f7a9

Please sign in to comment.