Snake Testing - UQcsse3200/2024-studio-2 GitHub Wiki
This details the tests run for the creation of a snake 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 form lines 910 to 986.
Testing
testSnakeInitialisation
Checks the initialisation of the NPC by verifying its creation, name, type, and the presence of necessary components. This includes:
-
Verifying that the
snake
object is not null, ensuring it was created successfully. -
Checking if the snake entity has the correct name "Snake" as specified in the configuration.
-
Confirming that the snake object is of type
Entity
, verifying its inheritance or implementation. -
Ensuring the snake entity has a
PhysicsComponent
, which is necessary for physical interactions. -
Validating that the snake entity includes a
PhysicsMovementComponent
, which handles its movement physics. -
Verifying that the snake entity has a
ColliderComponent
for collision detection. -
Checking if the snake entity has a
ConfigComponent
to manage its configuration settings.
Sound, BaseHint and NPC type Tests
-
TestSnakeHasCorrectSoundPath
: Ensures the sound path for the snake is correctly set to "sounds/snake-hiss.wav" in the configuration. -
TestSnakeHasCorrectBaseHint
: Confirms that the base hint for the magpie is set correctly, matching "HHIISSSSSSS, I am the mighty Snake of the Jungle!", "You look very tasty and I am very hungry", "Go play a game and collect me some apples...", and "/msOr I will eat you whole!". -
TestSnakeIsFriendly
: Ensures the snake entity has aFriendlyNPCAnimationController
, indicating that it is a non-aggressive NPC.
Movement Tests
TestSnakeHasAnimation
: Validates that the snake entity has an idle animation named "float", ensuring visual representation.TestSnakeSetPosition
: Verifies that the snake entity is placed correctly at the specified position (0,0) and can be moved to that location.