Docket - UQcsse3200/2024-studio-3 GitHub Wiki

Test Environment

  • Framework: JUnit 5
  • Objects Used: Docket (under test), Skin (mocked), Image (mocked)

Test Cases - Testing Docket Component Methods

  1. Docket Initialisation
    Purpose: To verify that the Docket component is properly initialised with default values.
    Expected Results:

    • Two Docket instances (docket and docket2) should be created without errors.
    • The start time of the second docket (docket2) should be initialised and greater than 0.
  2. Get Current Texture Name
    Purpose: To verify that the current texture name is correctly retrieved based on the drawable image assigned.
    Expected Results:

    • When the drawable is set, the returned texture name should match the first texture name in the texture array.
    • When the drawable is null, the returned texture name should be "none".
  3. Update Docket Textures
    Purpose: To verify that the Docket updates its textures correctly based on the remaining recipe time.
    Expected Results:

    • When paused, the texture should not change regardless of time updates.
    • When resumed, the texture should update appropriately based on the remaining time:
      • Remaining time = 1.5s → First texture.
      • Remaining time = 0.3s → Second texture.
      • Remaining time = 1s, total recipe time = 10s → Third texture.
      • Remaining time < 0 → Final texture.
  4. Set and Get Recipe Time
    Purpose: To verify that the recipe time is correctly set and retrieved.
    Expected Results:

    • Setting recipe time to 1.5 should return 1.5 when retrieved.
    • Setting recipe time to 3.8 should return 3.8 when retrieved.
  5. Set and Get Pause State
    Purpose: To ensure that the pause state can be toggled and retrieved correctly.
    Expected Results:

    • After setting paused to true, getPaused() should return true.
    • After setting paused to false, getPaused() should return false.
  6. Set and Get Skin
    Purpose: To verify that a new skin can be assigned to the Docket and retrieved correctly.
    Expected Results:

    • After setting a mocked Skin, getSkin() should return the same Skin instance.
  7. Set and Get Docket Image
    Purpose: To ensure that the docket image can be assigned and retrieved correctly.
    Expected Results:

    • After setting a mocked Image, getDocketImage() should return the same Image instance.
  8. Default Start Time Initialisation
    Purpose: To confirm that the start time is correctly initialised upon docket creation.
    Expected Results:

    • getStartTime() should return a value greater than 0.
  9. Set and Get Cell Hash
    Purpose: To verify that the cell hash value is correctly assigned and retrieved.
    Expected Results:

    • Setting the cell hash to 12345 should return 12345 when retrieved.
  10. Get Texture Name Array
    Purpose: To confirm that the texture name array is initialised with the correct values and length.
    Expected Results:

    • getTextureNameArray() should not return null.
    • The length of the texture name array should be 4.