How to use setChargingAttack method of be.seeseemelk.mockbukkit.entity.AbstractSkeletonMock class

Best MockBukkit code snippet using be.seeseemelk.mockbukkit.entity.AbstractSkeletonMock.setChargingAttack

Source:AbstractSkeletonMockTest.java Github

copy

Full Screen

...49 }50 @Test51 void testSetChargingAttack()52 {53 skeleton.setChargingAttack(true);54 assertTrue(skeleton.isChargingAttack());55 }56 @Test57 void testRangedAttack()58 {59 Player player = server.addPlayer();60 skeleton.rangedAttack(player, 0.5f);61 skeleton.assertAttacked(player, 0.5f);62 }63 @Test64 void testRangedAttackThrowsWithNullEntity()65 {66 assertThrows(NullPointerException.class, () -> skeleton.rangedAttack(null, 0.5f));67 }68 @Test69 void testRangedAttackThrowsWithInvalidCharge()70 {71 Player player = server.addPlayer();72 assertThrows(IllegalArgumentException.class, () -> skeleton.rangedAttack(player, -0.5f));73 assertThrows(IllegalArgumentException.class, () -> skeleton.rangedAttack(player, 1.5f));74 }75 @Test76 void testAssertAttackedThrowsWithNoAttack()77 {78 Player player = server.addPlayer();79 assertThrows(AssertionFailedError.class, () -> skeleton.assertAttacked(player, 0.5f));80 }81 @Test82 void testAssertAttackThrowsWithInvalidCharge()83 {84 Player player = server.addPlayer();85 skeleton.rangedAttack(player, 0.5f);86 assertThrows(IllegalArgumentException.class, () -> skeleton.assertAttacked(player, -0.5f));87 assertThrows(IllegalArgumentException.class, () -> skeleton.assertAttacked(player, 1.5f));88 }89 @Test90 void testAssertAttackThrowsWithWrongCharge()91 {92 Player player = server.addPlayer();93 skeleton.rangedAttack(player, 0.5f);94 assertThrows(AssertionFailedError.class, () -> skeleton.assertAttacked(player, 0.6f));95 }96 @Test97 void testAssertAgressiveAttack()98 {99 Player player = server.addPlayer();100 skeleton.setChargingAttack(true);101 skeleton.rangedAttack(player, 0.5f);102 skeleton.assertAgressiveAttack(player, 0.5f);103 }104 @Test105 void testAssertAgressiveAttackThrowsWhenNotAgressive()106 {107 Player player = server.addPlayer();108 skeleton.rangedAttack(player, 0.5f);109 assertThrows(AssertionFailedError.class, () -> skeleton.assertAgressiveAttack(player, 0.5f));110 }111}...

Full Screen

Full Screen

Source:AbstractSkeletonMock.java Github

copy

Full Screen

...47 Preconditions.checkArgument(charge < 1F && charge > 0F, "Charge needs to be between 0 and 1");48 this.attackedMobs.put(target, Pair.of(charge, this.isChargingAttack));49 }50 @Override51 public void setChargingAttack(boolean raiseHands)52 {53 this.isChargingAttack = raiseHands;54 }55 /**56 * Asserts that the given entity was attacked by this Skeleton with the given charge.57 *58 * @param entity The {@link LivingEntity} to check.59 * @param charge The charge of the attack.60 */61 public void assertAttacked(LivingEntity entity, float charge)62 {63 Preconditions.checkNotNull(entity, "Entity cannot be null");64 Preconditions.checkArgument(charge >= 0F && charge <= 1F, "Charge must be between 0 and 1");65 if (!attackedMobs.containsKey(entity) || attackedMobs.get(entity).getLeft() != charge)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run MockBukkit automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful