Search in sources :

Example 1 with WitherSkeleton

use of org.bukkit.entity.WitherSkeleton in project BentoBox by BentoBoxWorld.

the class TNTListenerTest method testOnTNTDamageInWorldTNTProjectileWitherSkelly.

@Test
public void testOnTNTDamageInWorldTNTProjectileWitherSkelly() {
    // Block on fire
    when(block.getType()).thenReturn(Material.TNT);
    // Entity is a projectile
    // Entity is an arrow
    Arrow arrow = mock(Arrow.class);
    // Shooter is a skeleton
    WitherSkeleton skeleton = mock(WitherSkeleton.class);
    when(arrow.getShooter()).thenReturn(skeleton);
    // Fire arrow
    when(arrow.getFireTicks()).thenReturn(10);
    EntityChangeBlockEvent e = new EntityChangeBlockEvent(arrow, block, Material.AIR.createBlockData());
    listener.onTNTDamage(e);
    assertFalse(e.isCancelled());
    verify(arrow, never()).remove();
}
Also used : Arrow(org.bukkit.entity.Arrow) EntityChangeBlockEvent(org.bukkit.event.entity.EntityChangeBlockEvent) WitherSkeleton(org.bukkit.entity.WitherSkeleton) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

Arrow (org.bukkit.entity.Arrow)1 WitherSkeleton (org.bukkit.entity.WitherSkeleton)1 EntityChangeBlockEvent (org.bukkit.event.entity.EntityChangeBlockEvent)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1