Recipie - UQcsse3200/2024-studio-3 GitHub Wiki
Test Environment
- Framework: JUnit 5
- Objects Used:
Recipe
(under test)SingleStationRecipeConfig
,MultiStationRecipeConfig
(mocked)
Test Cases - Testing Recipe Component Methods
-
Get Recipe Name
Purpose: To verify that the recipe name is correctly set and retrieved.
Expected Results:- Creating a recipe with the name
"steak"
should return"steak"
fromgetName()
.
- Creating a recipe with the name
-
Get Burned Time
Purpose: To ensure the burned time is correctly retrieved from the multi-station recipe configuration.
Expected Results:- When a multi-station recipe is set,
getBurnedTime()
should match the burned time from the configuration. - If no multi-station recipe is set,
getBurnedTime()
should returnnull
.
- When a multi-station recipe is set,
-
Recipe Validity Check
Purpose: To validate the logic that determines if a recipe is valid.
Expected Results:- If both single and multi-station recipes are
null
,isValid()
should returnfalse
. - If at least one of the recipes is set,
isValid()
should returntrue
.
- If both single and multi-station recipes are
-
Get Ingredients
Purpose: To verify that the correct ingredients are retrieved based on the recipe configuration.
Expected Results:- If both recipes are
null
,getIngredients()
should return an empty list. - If only the single-station recipe is set, it should return the ingredients from that recipe.
- If the multi-station recipe is set, it should return the ingredients from that recipe.
- If both recipes are
-
Get Making Time
Purpose: To verify that the making time is correctly retrieved based on the recipe configuration.
Expected Results:- If both recipes are
null
,getMakingTime()
should return0
. - If the single-station recipe is set, it should return the making time from that recipe.
- If the multi-station recipe is set, it should return the making time from that recipe.
- If both recipes are
-
Get Station Type (MultiStation Recipe Null)
Purpose: To verify the default station type when no multi-station recipe is set.
Expected Results:- If no multi-station recipe is set,
getStationType()
should return"CUTTING_BOARD"
.
- If no multi-station recipe is set,
-
Get Station Type (Frying Pan Exists)
Purpose: To verify the station type when the multi-station recipe has a frying pan configuration.
Expected Results:- If a frying pan is configured,
getStationType()
should return"FRYING_PAN"
.
- If a frying pan is configured,
-
Get Station Type (Oven Exists)
Purpose: To verify the station type when the multi-station recipe has an oven configuration but no frying pan.
Expected Results:- If an oven is configured but no frying pan exists,
getStationType()
should return"OVEN"
.
- If an oven is configured but no frying pan exists,
-
Get and Set SingleStation Recipe
Purpose: To verify that a single-station recipe can be assigned and retrieved.
Expected Results:- After setting a single-station recipe,
getSingleStationRecipe()
should return the same recipe.
- After setting a single-station recipe,
-
Get and Set MultiStation Recipe
Purpose: To verify that a multi-station recipe can be assigned and retrieved.
Expected Results:
- After setting a multi-station recipe,
getMultiStationRecipe()
should return the same recipe.