Testing plan for ROOM class - UQcsse3200/2024-studio-1 GitHub Wiki

TEST CASES

Test Room Connection

Objective: Verify that rooms can be correctly connected in both directions. Setup: Create two Room instances: room and connectedRoom. Execution: Connect room to connectedRoom in the NORTH direction using connectRoom(). Expected Outcomes: room.getConnectedRoom(RoomDirection.NORTH) should return connectedRoom. connectedRoom.getConnectedRoom(RoomDirection.SOUTH) should return room.

Test Item Addition

Objective: Ensure items can be added to a room and retrieved correctly. Setup: Create a Room instance and an Entity instance to serve as an item. Execution: Add the item to the room using addItem(). Expected Outcomes: room.getItems() should contain the added item. The size of room.getItems() should be 1.

Test Room State Changes

Objective: Verify that a room's "inside" state can be changed correctly. Setup: Create a Room instance. Execution: Check initial state with isInside(). Call enter() on the room. Check state again. Call exit() on the room. Check state one last time. Expected Outcomes: Initially, isInside() should return false. After enter(), isInside() should return true. After exit(), isInside() should return false.