Test Plan for StationItemHandler Component - UQcsse3200/2024-studio-3 GitHub Wiki
The purpose of this plan is to test the basic functionality of the ItemHandler as of Station teams push
Test Environment
- Framework: JUnit 4
- Objects Used: Station
Test Cases - Testing ItemHandlerComponent
- Setting the Current Item Purpose: To verify that the current item in the inventory is correctly set. Test methods: shouldSetCurrentItemTest() Expected outcome: The item set using setCurrentItem("meat") should be correctly retrieved as "meat" using getCurrentItem().
- Checking if an Item is Present Purpose: To verify that the inventory correctly identifies when an item is present. Test methods: shouldCheckItemPresentTest() Expected outcome: After setting an item, isItemPresent() should return true, indicating that an item is present.
- Removing an Item When Inventory is Empty Purpose: To verify that removing an item from an empty inventory returns an empty result. Test methods: shouldNotRemoveWhenStationIsEmpty() Expected outcome: When no item is set, removeCurrentItem() should return an empty Optional, indicating no item was removed.
- Checking if an Item is Absent Purpose: To verify that the inventory correctly identifies when no item is present. Test methods: shouldCheckItemAbsentTest() Expected outcome: If no item has been set, isItemPresent() should return false, indicating no item is present.
- Verifying Item Acceptance Purpose: To verify that an item is correctly recognized as present after being set. Test methods: shouldSetItemAccepted() Expected outcome: After setting an item, isItemPresent() should return true, confirming that the item is accepted and present in the inventory.
- Removing the Current Item Purpose: To verify that an item can be correctly removed from the inventory and that the inventory is empty afterward. Test methods: shouldRemoveCurrentItem() Expected outcome: After setting an item, removeCurrentItem() should return the item and isItemPresent() should return false, confirming the item was removed.