Merge pull request #594 from madsboddum/cu_quality_assurance

Wrote a couple of automated tests for "Your modified Speed" to ensure…
This commit is contained in:
Josh Larson
2022-07-04 13:15:25 -05:00
committed by GitHub
@@ -0,0 +1,32 @@
package com.projectswg.holocore.resources.support.objects.swg.weapon;
import com.projectswg.holocore.resources.support.objects.ObjectCreator;
import com.projectswg.holocore.test.resources.GenericCreatureObject;
import org.junit.Test;
import static org.junit.Assert.*;
public class WeaponObjectTest {
@Test
public void yourModifiedAttackSpeedTakesPresentSpeedModsIntoAccount() {
WeaponObject weaponObject = (WeaponObject) ObjectCreator.createObjectFromTemplate("object/weapon/melee/unarmed/shared_unarmed_default_player.iff");
weaponObject.setType(WeaponType.UNARMED);
weaponObject.setAttackSpeed(2.5f);
GenericCreatureObject genericCreatureObject = new GenericCreatureObject(1);
genericCreatureObject.adjustSkillmod("melee_speed", 0, 25);
genericCreatureObject.adjustSkillmod("unarmed_speed", 0, 25);
assertEquals(1.25, weaponObject.getModdedWeaponAttackSpeedWithCap(genericCreatureObject), 0);
}
@Test
public void yourModifiedAttackSpeedTakesMissingSpeedModsIntoAccount() {
WeaponObject weaponObject = (WeaponObject) ObjectCreator.createObjectFromTemplate("object/weapon/melee/unarmed/shared_unarmed_default_player.iff");
weaponObject.setType(WeaponType.UNARMED);
weaponObject.setAttackSpeed(2.5f);
GenericCreatureObject genericCreatureObject = new GenericCreatureObject(1);
assertEquals(2.5f, weaponObject.getModdedWeaponAttackSpeedWithCap(genericCreatureObject), 0);
}
}