Leviathan Testing Plan - UQcsse3200/2024-studio-2 GitHub Wiki
Testing Leviathan Entity
This section outlines the tests performed on the creation of the Leviathan entity. It verifies the functionality and components of the Leviathan NPC. These tests are located in BossFactoryTest.java
between lines 121 to 175.
Test Breakdown
TestWaterBossCreation
1. - Verifies that the Water Boss entity is successfully created and is not null.
- Assertion:
assertNotNull(waterBoss, "Water Boss should not be null.");
TestWaterBossIsEntity
2. - Confirms that the Water Boss is of type
Entity
, ensuring it correctly inherits from theEntity
class. - Assertion:
assertEquals(waterBoss.getClass(), Entity.class);
TestWaterBossHasComponents
3. - Verifies the presence of critical components for the Water Boss, including:
PhysicsComponent
for handling physics-related behaviors.PhysicsMovementComponent
for managing movement physics.ColliderComponent
for detecting collisions.BossAnimationController
for managing boss-specific animations.CombatStatsComponent
to track health and other combat stats.WaterAttackComponent
to handle water-based attacks.
- Assertions:
assertNotNull(waterBoss.getComponent(PhysicsComponent.class)); assertNotNull(waterBoss.getComponent(PhysicsMovementComponent.class)); assertNotNull(waterBoss.getComponent(ColliderComponent.class)); assertNotNull(waterBoss.getComponent(BossAnimationController.class)); assertNotNull(waterBoss.getComponent(CombatStatsComponent.class)); assertNotNull(waterBoss.getComponent(WaterAttackComponent.class));
TestWaterBossStats
4. - Confirms that the Water Boss has the correct initial combat stats, particularly 200 health points.
- Assertion:
assertEquals(200, waterBoss.getComponent(CombatStatsComponent.class).getHealth(), "Water Boss should have 200 HP.");
TestWaterBossAnimation
5. - Ensures the Water Boss has the correct animations, specifically checking for the "idle" animation.
- Assertion:
assertTrue(waterBoss.getComponent(AnimationRenderComponent.class).hasAnimation("idle"), "Water Boss should have idle animation.");
TestWaterBossSetPosition
6. - Verifies that the Water Boss can be set to a specific position, such as (0, 0).
- Assertion:
Vector2 pos = new Vector2(0f, 0f); waterBoss.setPosition(pos); assertEquals(pos, waterBoss.getPosition());
These tests ensure that the Leviathan entity is correctly initialized with essential components, proper animations.