-
Notifications
You must be signed in to change notification settings - Fork 1
Kanga Testing Plan
This section details the tests performed on the creation of the Kanga boss entity. It verifies various features and components to ensure the correct functionality of the Kanga NPC. These tests are located in BossFactoryTest.java
between lines 32 to 138.
- Verifies that the Kanga boss entity is successfully created, ensuring the object is not null.
-
Assertion:
assertNotNull(kanga, "Kanga should not be null.");
- Ensures that the Kanga boss is of type
Entity
, verifying the correct inheritance. -
Assertion:
assertEquals(kanga.getClass(), Entity.class);
- Checks the presence of necessary components for Kanga, including:
-
PhysicsComponent
for handling physical interactions. -
PhysicsMovementComponent
for movement physics. -
ColliderComponent
for collision detection. -
BossAnimationController
for managing animations. -
CombatStatsComponent
to track combat stats like health.
-
-
Assertions:
assertNotNull(kanga.getComponent(PhysicsComponent.class)); assertNotNull(kanga.getComponent(PhysicsMovementComponent.class)); assertNotNull(kanga.getComponent(ColliderComponent.class)); assertNotNull(kanga.getComponent(BossAnimationController.class)); assertNotNull(kanga.getComponent(CombatStatsComponent.class));
- Ensures the Kanga boss has the correct combat stats, starting with 150 health points.
-
Assertion:
assertEquals(150, kanga.getComponent(CombatStatsComponent.class).getHealth(), "Kanga should have 150 HP.");
- Validates that the Kanga boss has the correct animation, specifically checking for the "wander" animation.
-
Assertion:
assertTrue(kanga.getComponent(AnimationRenderComponent.class).hasAnimation("wander"), "Kanga should have wander animation.");
- Verifies that the Kanga boss can be positioned correctly at the specified location, such as (0,0).
-
Assertion:
Vector2 pos = new Vector2(0f, 0f); kanga.setPosition(pos); assertEquals(pos, kanga.getPosition());
These tests confirm that the Kanga boss entity is properly initialized with all essential components and configurations for interaction, movement, and combat.
https://youtu.be/Ny-1nAlynto?si=Xhmcj2f9uXhYmb0O&t=25
This section describes the tests performed for the KangaJoeyTask
, located in KangaJoeyTaskTest.java
. These tests ensure that the task is functioning correctly, especially with respect to prioritisation, range checking, and spawn management.
- Verifies that the task returns the correct priority when the target is within range, and the task is active.
-
Assertion:
assertEquals(5, kangaJoeyTask.getPriority());
- Ensures that the task returns a negative priority when the target is out of range.
-
Assertion:
assertEquals(-1, kangaJoeyTask.getPriority());
- Verifies that the task returns negative priority when the target is too far, even if the task is active.
-
Assertion:
assertEquals(-1, kangaJoeyTask.getPriority());
- Ensures that no more Joeys are spawned when the target moves out of range.
-
Assertion:
verify(eventHandler, times(1)).trigger(eq("spawnJoey"), eq(ownerEntity));
- Verifies that no more Joeys are spawned once the maximum number of spawns is reached.
-
Assertion:
verify(eventHandler, times(maxSpawns)).trigger(eq("spawnJoey"), eq(ownerEntity));
- Ensures that the task returns the correct priority when the target is within range, even when the task is inactive.
-
Assertion:
assertEquals(5, kangaJoeyTask.getPriority());
These tests confirm that the KangaJoeyTask
handles spawning, prioritisation, and range checking as expected.