Griffin Testing Plan - UQcsse3200/2024-studio-2 GitHub Wiki
Testing Griffin Entity
This section outlines the tests performed on the creation of the Griffin entity. It verifies the functionality and components of the Griffin NPC. These tests are located in BossFactoryTest.java
between lines 177 to 232.
Test Breakdown
TestAirBossCreation
1. - Verifies that the Air Boss entity is successfully created and is not null.
- Assertion:
assertNotNull(airBoss, "Air Boss should not be null.");
TestAirBossIsEntity
2. - Confirms that the Air Boss is of type
Entity
, ensuring it correctly inherits from theEntity
class. - Assertion:
assertEquals(airBoss.getClass(), Entity.class);
TestAirBossHasComponents
3. - Verifies the presence of critical components for the Air 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.AirAttackComponent
to handle air-based attacks.
- Assertions:
assertNotNull(airBoss.getComponent(PhysicsComponent.class)); assertNotNull(airBoss.getComponent(PhysicsMovementComponent.class)); assertNotNull(airBoss.getComponent(ColliderComponent.class)); assertNotNull(airBoss.getComponent(BossAnimationController.class)); assertNotNull(airBoss.getComponent(CombatStatsComponent.class)); assertNotNull(airBoss.getComponent(AirAttackComponent.class));
TestAirBossStats
4. - Confirms that the Air Boss has the correct initial combat stats, particularly 180 health points.
- Assertion:
assertEquals(180, airBoss.getComponent(CombatStatsComponent.class).getHealth(), "Air Boss should have 180 HP.");
TestAirBossAnimation
5. - Ensures the Air Boss has the correct animations, specifically checking for the "fly" animation.
- Assertion:
assertTrue(airBoss.getComponent(AnimationRenderComponent.class).hasAnimation("fly"), "Air Boss should have fly animation.");
TestAirBossSetPosition
6. - Verifies that the Air Boss can be set to a specific position, such as (0, 0).
- Assertion:
Vector2 pos = new Vector2(0f, 0f); airBoss.setPosition(pos); assertEquals(pos, airBoss.getPosition());
These tests ensure that the Air Boss entity is correctly initialized with essential components, proper animations, and air-specific attack capabilities.