### Question:
BlockListener implements Listener { @EventHandler(ignoreCancelled = true) public void onBlockPlace(BlockPlaceEvent event) { if (listenerService.shouldCancelEvent(event.getPlayer())) { event.setCancelled(true); } }  @EventHandler(ignoreCancelled = true) void onBlockPlace(BlockPlaceEvent event); @EventHandler(ignoreCancelled = true) void onBlockBreak(BlockBreakEvent event);  }### Answer:
@Test public void shouldAllowPlaceEvent() { Player player = mock(Player.class); BlockPlaceEvent event = mock(BlockPlaceEvent.class); given(event.getPlayer()).willReturn(player); given(listenerService.shouldCancelEvent(player)).willReturn(false); listener.onBlockPlace(event); verify(event).getPlayer(); verifyNoMoreInteractions(event); }
@Test public void shouldDenyPlaceEvent() { Player player = mock(Player.class); BlockPlaceEvent event = mock(BlockPlaceEvent.class); given(event.getPlayer()).willReturn(player); given(listenerService.shouldCancelEvent(player)).willReturn(true); listener.onBlockPlace(event); verify(event).setCancelled(true); verify(event).getPlayer(); verifyNoMoreInteractions(event); }