Order Actions - UQcsse3200/2024-studio-3 GitHub Wiki
Test Environment
- Framework: JUnit 5
- Objects Used:
OrderActions(under test)DocketService,InputService,Entity(mocked)EventListener0,Logger(mocked)
Test Cases - Testing OrderActions Component Methods
-
Component Setup
Purpose: To ensure that theOrderActionscomponent is properly initialised and registered with required services.
Expected Results:DocketServiceandInputServiceshould be registered with theServiceLocator.OrderActionsshould be correctly added to theEntityand retrievable throughgetComponent().
-
Shift Dockets Left - KeyDown Event
Purpose: To verify that pressing theLEFT_BRACKETkey triggers the "shiftDocketsLeft" event.
Expected Results:- The
keyDown()method should returntruewhen theLEFT_BRACKETkey is pressed. - The registered event listener for "shiftDocketsLeft" should be invoked.
- The
-
Shift Dockets Right - KeyDown Event
Purpose: To verify that pressing theRIGHT_BRACKETkey triggers the "shiftDocketsRight" event.
Expected Results:- The
keyDown()method should returntruewhen theRIGHT_BRACKETkey is pressed. - The registered event listener for "shiftDocketsRight" should be invoked.
- The
-
Unhandled Key - KeyDown Event
Purpose: To ensure that thekeyDown()method returnsfalsefor unhandled keys.
Expected Results:- Pressing the 'A' key should return
falseas it is not a handled key.
- Pressing the 'A' key should return
-
KeyUp Event
Purpose: To confirm that thekeyUp()method returnsfalsesince it does not perform any operations.
Expected Results:- Calling
keyUp()with any key (e.g., 'A') should returnfalse.
- Calling
-
KeyTyped Event
Purpose: To verify that thekeyTyped()method returnsfalsesince it does not perform any operations.
Expected Results:- Typing any character (e.g., 'A') should return
false.
- Typing any character (e.g., 'A') should return
-
Logger Initialisation
Purpose: To ensure that the logger forOrderActionsis properly initialised.
Expected Results:- Calling
getLogger()should return a non-null logger instance.
- Calling