From 71c923975b9723d4f8432fc02a0e82a9b1588cc2 Mon Sep 17 00:00:00 2001 From: tastybento Date: Wed, 18 Mar 2020 08:50:10 -0700 Subject: [PATCH] Fixes tests for PVPListener class. Were broken by PR https://github.com/BentoBoxWorld/BentoBox/pull/1230 --- .../listeners/flags/settings/PVPListenerTest.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/test/java/world/bentobox/bentobox/listeners/flags/settings/PVPListenerTest.java b/src/test/java/world/bentobox/bentobox/listeners/flags/settings/PVPListenerTest.java index c556d9f7c..7cdc8bff3 100644 --- a/src/test/java/world/bentobox/bentobox/listeners/flags/settings/PVPListenerTest.java +++ b/src/test/java/world/bentobox/bentobox/listeners/flags/settings/PVPListenerTest.java @@ -784,7 +784,9 @@ public class PVPListenerTest { map.put(creeper, 10D); PotionSplashEvent e = new PotionSplashEvent(tp, map); new PVPListener().onSplashPotionSplash(e); - assertTrue(e.isCancelled()); + assertFalse(e.getAffectedEntities().contains(player2)); + assertTrue(e.getAffectedEntities().contains(zombie)); + assertTrue(e.getAffectedEntities().contains(creeper)); verify(notifier).notify(any(), eq(Flags.PVP_OVERWORLD.getHintReference())); // Wrong world @@ -839,7 +841,9 @@ public class PVPListenerTest { map.put(creeper, 10D); PotionSplashEvent e = new PotionSplashEvent(tp, map); new PVPListener().onSplashPotionSplash(e); - assertFalse(e.isCancelled()); + assertTrue(e.getAffectedEntities().contains(player2)); + assertTrue(e.getAffectedEntities().contains(zombie)); + assertTrue(e.getAffectedEntities().contains(creeper)); verify(player, never()).sendMessage(Flags.PVP_OVERWORLD.getHintReference()); } @@ -867,7 +871,9 @@ public class PVPListenerTest { when(iwm.getIvSettings(any())).thenReturn(Collections.singletonList("ENTITY_ATTACK")); new PVPListener().onSplashPotionSplash(e); // visitor should be protected - assertTrue(e.isCancelled()); + assertFalse(e.getAffectedEntities().contains(player2)); + assertTrue(e.getAffectedEntities().contains(zombie)); + assertTrue(e.getAffectedEntities().contains(creeper)); verify(notifier).notify(any(), eq(Flags.INVINCIBLE_VISITORS.getHintReference())); // Wrong world