Fixes tests for PVPListener class.

Were broken by PR https://github.com/BentoBoxWorld/BentoBox/pull/1230
This commit is contained in:
tastybento 2020-03-18 08:50:10 -07:00
parent 706bed62ec
commit 71c923975b

View File

@ -784,7 +784,9 @@ public class PVPListenerTest {
map.put(creeper, 10D); map.put(creeper, 10D);
PotionSplashEvent e = new PotionSplashEvent(tp, map); PotionSplashEvent e = new PotionSplashEvent(tp, map);
new PVPListener().onSplashPotionSplash(e); 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())); verify(notifier).notify(any(), eq(Flags.PVP_OVERWORLD.getHintReference()));
// Wrong world // Wrong world
@ -839,7 +841,9 @@ public class PVPListenerTest {
map.put(creeper, 10D); map.put(creeper, 10D);
PotionSplashEvent e = new PotionSplashEvent(tp, map); PotionSplashEvent e = new PotionSplashEvent(tp, map);
new PVPListener().onSplashPotionSplash(e); 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()); verify(player, never()).sendMessage(Flags.PVP_OVERWORLD.getHintReference());
} }
@ -867,7 +871,9 @@ public class PVPListenerTest {
when(iwm.getIvSettings(any())).thenReturn(Collections.singletonList("ENTITY_ATTACK")); when(iwm.getIvSettings(any())).thenReturn(Collections.singletonList("ENTITY_ATTACK"));
new PVPListener().onSplashPotionSplash(e); new PVPListener().onSplashPotionSplash(e);
// visitor should be protected // 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())); verify(notifier).notify(any(), eq(Flags.INVINCIBLE_VISITORS.getHintReference()));
// Wrong world // Wrong world