### Question:
EntityListener implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void entityRegainHealthEvent(EntityRegainHealthEvent event) { if (listenerService.shouldCancelEvent(event)) { event.setAmount(0); event.setCancelled(true); } } @Inject  EntityListener(ListenerService listenerService); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onDamage(EntityDamageEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onAttack(EntityDamageByEntityEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onEntityTarget(EntityTargetEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onFoodLevelChange(FoodLevelChangeEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void entityRegainHealthEvent(EntityRegainHealthEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) void onEntityInteract(EntityInteractEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onLowestEntityInteract(EntityInteractEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) void onProjectileLaunch(ProjectileLaunchEvent event); @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) void onShoot(EntityShootBowEvent event);  }### Answer:
@Test public void shouldCancelRegainHealthEvent() { EntityRegainHealthEvent event = mock(EntityRegainHealthEvent.class); given(listenerService.shouldCancelEvent(event)).willReturn(true); listener.entityRegainHealthEvent(event); verify(listenerService).shouldCancelEvent(event); verify(event).setCancelled(true); verify(event).setAmount(0); }
@Test public void shouldNotCancelRegainedHealth() { EntityRegainHealthEvent event = mock(EntityRegainHealthEvent.class); given(listenerService.shouldCancelEvent(event)).willReturn(false); listener.entityRegainHealthEvent(event); verify(listenerService).shouldCancelEvent(event); verifyZeroInteractions(event); }