### Question:
PlayerListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onPlayerInventoryClick(InventoryClickEvent event) { if (listenerService.shouldCancelEvent(event.getWhoClicked())) { event.setCancelled(true); } }  @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerChat(AsyncPlayerChatEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) void onPlayerMove(PlayerMoveEvent event); @EventHandler(priority = EventPriority.HIGHEST) void onJoinMessage(PlayerJoinEvent event); @EventHandler(priority = EventPriority.NORMAL) void onPlayerJoin(PlayerJoinEvent event); @EventHandler(priority = EventPriority.HIGHEST) void onAsyncPlayerPreLoginEvent(AsyncPlayerPreLoginEvent event); @EventHandler(priority = EventPriority.LOW) void onPlayerLogin(PlayerLoginEvent event); @EventHandler(priority = EventPriority.HIGHEST) void onPlayerQuit(PlayerQuitEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) void onPlayerKick(PlayerKickEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerPickupItem(PlayerPickupItemEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerHeldItem(PlayerItemHeldEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerInteract(PlayerInteractEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerConsumeItem(PlayerItemConsumeEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerInventoryOpen(InventoryOpenEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerInventoryClick(InventoryClickEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerHitPlayerEvent(EntityDamageByEntityEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerInteractEntity(PlayerInteractEntityEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerDropItem(PlayerDropItemEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerBedEnter(PlayerBedEnterEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onSignChange(SignChangeEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) void onPlayerRespawn(PlayerRespawnEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerShear(PlayerShearEntityEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onPlayerFish(PlayerFishEvent event);  }### Answer:
@Test public void shouldCancelInventoryClickEvent() { InventoryClickEvent event = mock(InventoryClickEvent.class); HumanEntity player = mock(Player.class); given(event.getWhoClicked()).willReturn(player); given(listenerService.shouldCancelEvent(player)).willReturn(true); listener.onPlayerInventoryClick(event); verify(event).setCancelled(true); }
@Test public void shouldAllowInventoryClickEvent() { InventoryClickEvent event = mock(InventoryClickEvent.class); HumanEntity player = mock(Player.class); given(event.getWhoClicked()).willReturn(player); given(listenerService.shouldCancelEvent(player)).willReturn(false); listener.onPlayerInventoryClick(event); verify(event, only()).getWhoClicked(); }