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

View File

@ -180,7 +180,6 @@ public class InvincibleVisitorsListenerTest {
}
@SuppressWarnings("deprecation")
@Test
public void testOnVisitorGetDamageNotPlayer() {
LivingEntity le = mock(LivingEntity.class);
@ -189,7 +188,6 @@ public class InvincibleVisitorsListenerTest {
assertFalse(e.isCancelled());
}
@SuppressWarnings("deprecation")
@Test
public void testOnVisitorGetDamageNotInWorld() {
when(iwm.inWorld(Mockito.any())).thenReturn(false);
@ -198,7 +196,6 @@ public class InvincibleVisitorsListenerTest {
assertFalse(e.isCancelled());
}
@SuppressWarnings("deprecation")
@Test
public void testOnVisitorGetDamageNotInIvSettings() {
when(iwm.inWorld(Mockito.any())).thenReturn(false);
@ -207,7 +204,6 @@ public class InvincibleVisitorsListenerTest {
assertFalse(e.isCancelled());
}
@SuppressWarnings("deprecation")
@Test
public void testOnVisitorGetDamageNotVisitor() {
EntityDamageEvent e = new EntityDamageEvent(player, EntityDamageEvent.DamageCause.CRAMMING, 0D);
@ -216,7 +212,6 @@ public class InvincibleVisitorsListenerTest {
assertFalse(e.isCancelled());
}
@SuppressWarnings("deprecation")
@Test
public void testOnVisitorGetDamageNotVoid() {
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));
}
@SuppressWarnings("deprecation")
@Test
public void testOnVisitorGetDamageVoid() {
// 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.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.World;
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.inventory.ItemFactory;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.material.MaterialData;
import org.bukkit.plugin.PluginManager;
import org.junit.Before;
import org.junit.Test;
@ -115,7 +113,6 @@ public class ItemFrameListenerTest {
enderman = mock(Enderman.class);
when(enderman.getLocation()).thenReturn(location);
when(enderman.getWorld()).thenReturn(world);
when(enderman.getCarriedMaterial()).thenReturn(new MaterialData(Material.STONE));
slime = mock(Slime.class);
when(slime.getLocation()).thenReturn(location);
@ -152,7 +149,6 @@ public class ItemFrameListenerTest {
ItemFrameListener ifl = new ItemFrameListener();
Entity entity = mock(ItemFrame.class);
DamageCause cause = DamageCause.ENTITY_ATTACK;
@SuppressWarnings("deprecation")
EntityDamageByEntityEvent e = new EntityDamageByEntityEvent(enderman, entity, cause , 0);
ifl.onItemFrameDamage(e);
assertTrue(e.isCancelled());
@ -166,7 +162,6 @@ public class ItemFrameListenerTest {
ItemFrameListener ifl = new ItemFrameListener();
Entity entity = mock(Monster.class);
DamageCause cause = DamageCause.ENTITY_ATTACK;
@SuppressWarnings("deprecation")
EntityDamageByEntityEvent e = new EntityDamageByEntityEvent(enderman, entity, cause , 0);
ifl.onItemFrameDamage(e);
assertFalse(e.isCancelled());
@ -182,7 +177,6 @@ public class ItemFrameListenerTest {
DamageCause cause = DamageCause.ENTITY_ATTACK;
Projectile p = mock(Projectile.class);
when(p.getShooter()).thenReturn(enderman);
@SuppressWarnings("deprecation")
EntityDamageByEntityEvent e = new EntityDamageByEntityEvent(p, entity, cause , 0);
ifl.onItemFrameDamage(e);
assertTrue(e.isCancelled());
@ -199,7 +193,6 @@ public class ItemFrameListenerTest {
Projectile p = mock(Projectile.class);
Player player = mock(Player.class);
when(p.getShooter()).thenReturn(player);
@SuppressWarnings("deprecation")
EntityDamageByEntityEvent e = new EntityDamageByEntityEvent(p, entity, cause , 0);
ifl.onItemFrameDamage(e);
assertFalse(e.isCancelled());

View File

@ -354,7 +354,6 @@ public class FlyingMobEventsTest {
* @param data the future block data
* @deprecated Magic value
*/
@SuppressWarnings("deprecation")
EntityChangeBlockEvent e = new EntityChangeBlockEvent(wither, mock(Block.class), Material.AIR.createBlockData());
// Blocked
fme.onWitherChangeBlocks(e);