Test Plan for FireExtinguisherHandlerComponent - UQcsse3200/2024-studio-3 GitHub Wiki

Test Environment

  • Framework: JUnit 5
  • Objects Used:
  • FireExtinguisherHandlerComponent
  • InventoryComponent
  • Entity (mocked)
  • EventHandler (mocked)

Test Cases - Testing FireExtinguisherHandlerComponent Methods

  1. Test Case: Should give extinguisher

Purpose: To verify that the FireExtinguisherHandlerComponent can add a fire extinguisher to the entity's inventory. Expected Results:

Initially, the entity's inventory should not contain a fire extinguisher. After calling givePutExtinguisher() on the handler, the inventory should contain one fire extinguisher item.

  1. Test Case: Should return extinguisher

Purpose: To verify that the FireExtinguisherHandlerComponent can remove a fire extinguisher from the entity's inventory if it is already present. Expected Results:

After ensuring that the inventory contains a fire extinguisher by calling shouldGiveExtinguisher(), calling givePutExtinguisher() again should remove the fire extinguisher from the inventory. The inventory should not contain a fire extinguisher after the second call to givePutExtinguisher().