Clean up on the test classes for 1.13.

This commit is contained in:
tastybento 2018-08-01 10:12:43 -07:00
parent 733fc3d1c9
commit df5d63acf0
4 changed files with 28 additions and 43 deletions

View File

@ -29,7 +29,6 @@ import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemFactory; import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.material.MaterialData;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -112,7 +111,7 @@ public class EndermanListenerTest {
enderman = mock(Enderman.class); enderman = mock(Enderman.class);
when(enderman.getLocation()).thenReturn(location); when(enderman.getLocation()).thenReturn(location);
when(enderman.getWorld()).thenReturn(world); when(enderman.getWorld()).thenReturn(world);
when(enderman.getCarriedMaterial()).thenReturn(new MaterialData(Material.STONE)); when(enderman.getCarriedBlock()).thenReturn(Material.STONE.createBlockData());
slime = mock(Slime.class); slime = mock(Slime.class);
when(slime.getLocation()).thenReturn(location); when(slime.getLocation()).thenReturn(location);
@ -215,7 +214,7 @@ public class EndermanListenerTest {
*/ */
@Test @Test
public void testOnEndermanDeathCarryAir() { public void testOnEndermanDeathCarryAir() {
when(enderman.getCarriedMaterial()).thenReturn(new MaterialData(Material.AIR)); when(enderman.getCarriedBlock()).thenReturn(Material.AIR.createBlockData());
EndermanListener listener = new EndermanListener(); EndermanListener listener = new EndermanListener();
EntityDeathEvent e = new EntityDeathEvent(enderman, new ArrayList<ItemStack>()); EntityDeathEvent e = new EntityDeathEvent(enderman, new ArrayList<ItemStack>());
listener.onEndermanDeath(e); listener.onEndermanDeath(e);

View File

@ -180,7 +180,6 @@ public class InvincibleVisitorsListenerTest {
} }
@SuppressWarnings("deprecation")
@Test @Test
public void testOnVisitorGetDamageNotPlayer() { public void testOnVisitorGetDamageNotPlayer() {
LivingEntity le = mock(LivingEntity.class); LivingEntity le = mock(LivingEntity.class);
@ -189,7 +188,6 @@ public class InvincibleVisitorsListenerTest {
assertFalse(e.isCancelled()); assertFalse(e.isCancelled());
} }
@SuppressWarnings("deprecation")
@Test @Test
public void testOnVisitorGetDamageNotInWorld() { public void testOnVisitorGetDamageNotInWorld() {
when(iwm.inWorld(Mockito.any())).thenReturn(false); when(iwm.inWorld(Mockito.any())).thenReturn(false);
@ -198,7 +196,6 @@ public class InvincibleVisitorsListenerTest {
assertFalse(e.isCancelled()); assertFalse(e.isCancelled());
} }
@SuppressWarnings("deprecation")
@Test @Test
public void testOnVisitorGetDamageNotInIvSettings() { public void testOnVisitorGetDamageNotInIvSettings() {
when(iwm.inWorld(Mockito.any())).thenReturn(false); when(iwm.inWorld(Mockito.any())).thenReturn(false);
@ -207,7 +204,6 @@ public class InvincibleVisitorsListenerTest {
assertFalse(e.isCancelled()); assertFalse(e.isCancelled());
} }
@SuppressWarnings("deprecation")
@Test @Test
public void testOnVisitorGetDamageNotVisitor() { public void testOnVisitorGetDamageNotVisitor() {
EntityDamageEvent e = new EntityDamageEvent(player, EntityDamageEvent.DamageCause.CRAMMING, 0D); EntityDamageEvent e = new EntityDamageEvent(player, EntityDamageEvent.DamageCause.CRAMMING, 0D);
@ -216,7 +212,6 @@ public class InvincibleVisitorsListenerTest {
assertFalse(e.isCancelled()); assertFalse(e.isCancelled());
} }
@SuppressWarnings("deprecation")
@Test @Test
public void testOnVisitorGetDamageNotVoid() { public void testOnVisitorGetDamageNotVoid() {
EntityDamageEvent e = new EntityDamageEvent(player, EntityDamageEvent.DamageCause.CRAMMING, 0D); EntityDamageEvent e = new EntityDamageEvent(player, EntityDamageEvent.DamageCause.CRAMMING, 0D);
@ -225,7 +220,6 @@ public class InvincibleVisitorsListenerTest {
Mockito.verify(player, Mockito.never()).setGameMode(Mockito.eq(GameMode.SPECTATOR)); Mockito.verify(player, Mockito.never()).setGameMode(Mockito.eq(GameMode.SPECTATOR));
} }
@SuppressWarnings("deprecation")
@Test @Test
public void testOnVisitorGetDamageVoid() { public void testOnVisitorGetDamageVoid() {
// For testing, have no island to teleport to // For testing, have no island to teleport to

View File

@ -17,7 +17,6 @@ import java.util.logging.Logger;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Enderman; import org.bukkit.entity.Enderman;
@ -33,7 +32,6 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.inventory.ItemFactory; import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.material.MaterialData;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -115,7 +113,6 @@ public class ItemFrameListenerTest {
enderman = mock(Enderman.class); enderman = mock(Enderman.class);
when(enderman.getLocation()).thenReturn(location); when(enderman.getLocation()).thenReturn(location);
when(enderman.getWorld()).thenReturn(world); when(enderman.getWorld()).thenReturn(world);
when(enderman.getCarriedMaterial()).thenReturn(new MaterialData(Material.STONE));
slime = mock(Slime.class); slime = mock(Slime.class);
when(slime.getLocation()).thenReturn(location); when(slime.getLocation()).thenReturn(location);
@ -152,7 +149,6 @@ public class ItemFrameListenerTest {
ItemFrameListener ifl = new ItemFrameListener(); ItemFrameListener ifl = new ItemFrameListener();
Entity entity = mock(ItemFrame.class); Entity entity = mock(ItemFrame.class);
DamageCause cause = DamageCause.ENTITY_ATTACK; DamageCause cause = DamageCause.ENTITY_ATTACK;
@SuppressWarnings("deprecation")
EntityDamageByEntityEvent e = new EntityDamageByEntityEvent(enderman, entity, cause , 0); EntityDamageByEntityEvent e = new EntityDamageByEntityEvent(enderman, entity, cause , 0);
ifl.onItemFrameDamage(e); ifl.onItemFrameDamage(e);
assertTrue(e.isCancelled()); assertTrue(e.isCancelled());
@ -166,7 +162,6 @@ public class ItemFrameListenerTest {
ItemFrameListener ifl = new ItemFrameListener(); ItemFrameListener ifl = new ItemFrameListener();
Entity entity = mock(Monster.class); Entity entity = mock(Monster.class);
DamageCause cause = DamageCause.ENTITY_ATTACK; DamageCause cause = DamageCause.ENTITY_ATTACK;
@SuppressWarnings("deprecation")
EntityDamageByEntityEvent e = new EntityDamageByEntityEvent(enderman, entity, cause , 0); EntityDamageByEntityEvent e = new EntityDamageByEntityEvent(enderman, entity, cause , 0);
ifl.onItemFrameDamage(e); ifl.onItemFrameDamage(e);
assertFalse(e.isCancelled()); assertFalse(e.isCancelled());
@ -182,7 +177,6 @@ public class ItemFrameListenerTest {
DamageCause cause = DamageCause.ENTITY_ATTACK; DamageCause cause = DamageCause.ENTITY_ATTACK;
Projectile p = mock(Projectile.class); Projectile p = mock(Projectile.class);
when(p.getShooter()).thenReturn(enderman); when(p.getShooter()).thenReturn(enderman);
@SuppressWarnings("deprecation")
EntityDamageByEntityEvent e = new EntityDamageByEntityEvent(p, entity, cause , 0); EntityDamageByEntityEvent e = new EntityDamageByEntityEvent(p, entity, cause , 0);
ifl.onItemFrameDamage(e); ifl.onItemFrameDamage(e);
assertTrue(e.isCancelled()); assertTrue(e.isCancelled());
@ -199,7 +193,6 @@ public class ItemFrameListenerTest {
Projectile p = mock(Projectile.class); Projectile p = mock(Projectile.class);
Player player = mock(Player.class); Player player = mock(Player.class);
when(p.getShooter()).thenReturn(player); when(p.getShooter()).thenReturn(player);
@SuppressWarnings("deprecation")
EntityDamageByEntityEvent e = new EntityDamageByEntityEvent(p, entity, cause , 0); EntityDamageByEntityEvent e = new EntityDamageByEntityEvent(p, entity, cause , 0);
ifl.onItemFrameDamage(e); ifl.onItemFrameDamage(e);
assertFalse(e.isCancelled()); assertFalse(e.isCancelled());

View File

@ -347,14 +347,13 @@ public class FlyingMobEventsTest {
fme.onMobSpawn(cee); fme.onMobSpawn(cee);
// Create event // Create event
/** /**
* *
* @param what the Entity causing the change * @param what the Entity causing the change
* @param block the block (before the change) * @param block the block (before the change)
* @param to the future material being changed to * @param to the future material being changed to
* @param data the future block data * @param data the future block data
* @deprecated Magic value * @deprecated Magic value
*/ */
@SuppressWarnings("deprecation")
EntityChangeBlockEvent e = new EntityChangeBlockEvent(wither, mock(Block.class), Material.AIR.createBlockData()); EntityChangeBlockEvent e = new EntityChangeBlockEvent(wither, mock(Block.class), Material.AIR.createBlockData());
// Blocked // Blocked
fme.onWitherChangeBlocks(e); fme.onWitherChangeBlocks(e);