Skip to content

Commit

Permalink
Added JUnit testing for stun and burn effect
Browse files Browse the repository at this point in the history
  • Loading branch information
cindyle1 committed Sep 10, 2023
1 parent 0953724 commit 3a5d072
Showing 1 changed file with 50 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.csse3200.game.components.CombatStatsComponent;
import com.csse3200.game.components.CostComponent;
import com.csse3200.game.components.DeleteOnMapEdgeComponent;
import com.csse3200.game.components.TouchAttackComponent;
import com.csse3200.game.components.projectile.EngineerBulletsAnimationController;
import com.csse3200.game.components.projectile.MobKingProjectAnimController;
import com.csse3200.game.components.projectile.MobProjectileAnimationController;
import com.csse3200.game.components.projectile.ProjectileAnimationController;
import com.csse3200.game.components.*;
import com.csse3200.game.components.projectile.*;
import com.csse3200.game.entities.Entity;
import com.csse3200.game.extensions.GameExtension;
import com.csse3200.game.physics.PhysicsLayer;
Expand Down Expand Up @@ -48,7 +42,9 @@ class ProjectileFactoryTest {
"images/projectiles/mobProjectile.atlas",
"images/projectiles/basic_projectile.atlas",
"images/projectiles/mobKing_projectile.atlas",
"images/projectiles/engineer_projectile.atlas"
"images/projectiles/engineer_projectile.atlas",
"images/projectiles/stun_effect.atlas",
"images/projectiles/burn_effect.atlas"
};

private final String[] animations = {
Expand Down Expand Up @@ -208,5 +204,50 @@ public void testEngineerAnimationController() {
assertNotNull(engineerBullet.getComponent(EngineerBulletsAnimationController.class),
"Engineer Bullet does not have Animation Controller");
}

@Test
public void testStunProjectileCreation() {
Entity stunProjectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.NPC, new Vector2(0.1f,
0.1f), new Vector2(2,2), ProjectileEffects.STUN, false);
assertNotNull(stunProjectile, "stunProjectile is null");
}

@Test
public void testStunProjectileAnimationRenderComponent() {
Entity stunProjectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.NPC, new Vector2(0.1f,01f),
new Vector2(2,2), ProjectileEffects.STUN, false);
assertNotNull(stunProjectile.getComponent(AnimationRenderComponent.class),
"Stun Projectile does not have AnimationRenderComponent");
}

@Test
public void testStunProjectileAnimationController() {
Entity stunProjectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.TOWER, new Vector2(0.1f, 0.1f)
, new Vector2(2,2), ProjectileEffects.STUN, false);
assertNotNull(stunProjectile.getComponent(StunEffectProjectileAnimationController.class),
"Stun Projectile does not have Animation Controller");
}

@Test
public void testBurnProjectileCreation() {
Entity burnProjectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.NPC, new Vector2(0.1f,
0.1f), new Vector2(2,2), ProjectileEffects.BURN, false);
assertNotNull(burnProjectile, "burnProjectile is null");
}

@Test
public void testBurnProjectileAnimationRenderComponent() {
Entity burnProjectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.NPC, new Vector2(0.1f,01f),
new Vector2(2,2), ProjectileEffects.BURN, false);
assertNotNull(burnProjectile.getComponent(AnimationRenderComponent.class),
"Burn Projectile does not have AnimationRenderComponent");
}
@Test
public void testBurnProjectileAnimationController() {
Entity burnProjectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.TOWER, new Vector2(0.1f, 0.1f)
, new Vector2(2,2), ProjectileEffects.BURN, false);
assertNotNull(burnProjectile.getComponent(BurnEffectProjectileAnimationController.class),
"Burn Projectile does not have Animation Controller");
}
}

0 comments on commit 3a5d072

Please sign in to comment.