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

  1. 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" from getName().
  2. 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 return null.
  3. 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 return false.
    • If at least one of the recipes is set, isValid() should return true.
  4. 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.
  5. 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 return 0.
    • 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.
  6. 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".
  7. 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".
  8. 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".
  9. 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.
  10. 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.