Fixed tests

Created two new tests:

1. A test that closing inventory does not happen unless it is a known
panel.
2. A test that verifies known panels are closed.
This commit is contained in:
tastybento 2018-09-08 10:35:40 -07:00
parent 918f6de782
commit d744b58638

View File

@ -120,7 +120,20 @@ public class PanelListenerManagerTest {
* Test method for {@link world.bentobox.bentobox.listeners.PanelListenerManager#onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent)}.
*/
@Test
public void testOnInventoryClickOutside() {
public void testOnInventoryClickOutsideUnknownPanel() {
SlotType type = SlotType.OUTSIDE;
InventoryClickEvent e = new InventoryClickEvent(view, type, 0, click, inv);
plm.onInventoryClick(e);
Mockito.verify(player, Mockito.never()).closeInventory();
}
/**
* Test method for {@link world.bentobox.bentobox.listeners.PanelListenerManager#onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent)}.
*/
@Test
public void testOnInventoryClickOutsideKnownPanel() {
// Put a panel in the list
PanelListenerManager.getOpenPanels().put(uuid, panel);
SlotType type = SlotType.OUTSIDE;
InventoryClickEvent e = new InventoryClickEvent(view, type, 0, click, inv);
plm.onInventoryClick(e);