Magpie Testing - UQcsse3200/2024-studio-2 GitHub Wiki
This details the tests run for the creation of a magpie entity. It tests various features and ensures the correct creation of that NPC. These tests can be located in NPCFactoryTest.java
and can be found from lines 988 to 1064.
Testing
testMagpieInitialisation
Checks the initialisation of the NPC by verifying its creation, name, type, and the presence of necessary components. This includes:
-
Verifying that the
magpie
object is not null, ensuring it was created successfully. -
Checking if the magpie entity has the correct name "Magpie" as specified in the configuration.
-
Confirming that the magpie object is of type
Entity
, verifying its inheritance or implementation. -
Ensuring the magpie entity has a
PhysicsComponent
, which is necessary for physical interactions. -
Validating that the magpie entity includes a
PhysicsMovementComponent
, which handles its movement physics. -
Verifying that the magpie entity has a
ColliderComponent
for collision detection. -
Checking if the magpie entity has a
ConfigComponent
to manage its configuration settings.
Sound, BaseHint and NPC type Tests
-
TestMagpieHasCorrectSoundPath
: Ensures the sound path for the magpie is correctly set to "sounds/aus-magpie.wav" in the configuration. -
TestMagpieHasCorrectBaseHint
: Confirms that the base hint for the magpie is set correctly, matching "Welcome to Animal Kingdom!" and "I am Maggie the Magpie." -
TestMagpieIsFriendly
: Ensures the magpie entity has aFriendlyNPCAnimationController
, indicating that it is a non-aggressive NPC.
Movement Tests
TestMagpieHasAnimation
: Validates that the magpie entity has an idle animation named "float", ensuring visual representation.TestMagpieSetPosition
: Verifies that the magpie entity is placed correctly at the specified position (0,0) and can be moved to that location.