Skip to content

ExtortionUpgrade

willembor edited this page Oct 17, 2024 · 1 revision

Test Environment

  • Framework: JUNIT 5
  • Dependencies:
  • Mockito: For mocking dependencies
  • ParameterizedTest: For testing different inputs

Test Cases

1. testExtortionUpgradeActivates

  • Purpose: Ensure that the Extortion upgrade activates correctly and all relevant UI elements become visible.
  • Setup:
    • Set player gold to a sufficient amount (100).
    • Call activate() on the extortionUpgrade instance.
    • Trigger the event "extortion active".
  • Expected Outcome:
    • The upgrade should activate, and the layout should be visible.
    • The meter should show full (value = 1.0), and the event "extortion active"
    • activateTimeRemaining should be set to UPGRADE_DURATION.

2. testExtortionUpgradeDeactivates

  • Purpose: Ensure the Extortion upgrade deactivates correctly and UI elements are hidden.
  • Setup:
    • Call activate() and then deactivate() on the extortionUpgrade.
    • Trigger the event "UnDancing".
  • Expected:
    • The upgrade should deactivate, and the meter and text should be removed from the stage.
    • The layout should be hidden, and the event "UnDancing" should be triggered.
    • The meter value should reset to 0.

3. testLoseGoldOnPurchase

  • Purpose: Ensure the correct amount of gold is deducted when the Extortion upgrade is purchased.
  • Setup:
    • Set player gold to 100.
    • Call activate() on extortionUpgrade.
  • Expected: The player's gold should decrease by 40 upon activation.

4. testInsufficientGold

  • Purpose: Ensure the Extortion upgrade does not activate if there is insufficient gold.
  • Setup:
    • Set player gold to an insufficient amount (e.g., 10).
    • Call activate() and verify that the event notenoughmoney is triggered.
  • Expected: The upgrade should not activate, and the layout should remain hidden. Also event notenoughmoney should be triggered

5. testExtortionUpgradeFor30Seconds

  • Purpose: Ensure the Extortion upgrade lasts for 30 seconds and deactivates afterward.
  • Setup: Activate the upgrade and simulate 30 seconds by calling update() repeatedly.
  • Expected:
    • The meter value should gradually deplete as time passes.
    • After 30 seconds, the upgrade should deactivate.

6. testMeterValueAtDifferentLevelsOfDepletion

  • Purpose: Ensure that the meter value updates correctly as the upgrade time depletes.
  • Setup:
    • Use parameterized values for the total depleted time (5, 10, 15, 20, 25, 30 seconds).
    • Activate the upgrade and simulate time by calling update() based on the given value.
  • Expected: The meter value should reflect the remaining upgrade time relative to the total duration.

7. testDispose

  • Purpose: Ensure that all resources related to the Extortion upgrade are unloaded correctly when dispose() is called.
  • Setup:
    • Call dispose() on the extortionUpgrade instance.
    • Verify that the resourceService.unloadAssets() method is called for the textures.
  • Expected: The textures related to the Extortion upgrade should be unloaded from memory.

Table of Contents

Home

Team Design Document

Game Features

Inventory System
Scoring System
Food Recipes
Level System
Player Actions
Ordering System
Stations
Items
Map Design
Customers
Pause Menu
Upgrades
End of Day Display
Day Night Cycle
Moral System
Debug Terminal
Game Interactions Tutorial
Backstory Cutscenes

Game

Getting Started

Entities and Components

World Backstory

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Map Design

Test Plans

Sensor Component

Customer Sensor Component

Interaction Component

Inventory Component

Inventory Display

Station Meal Component

Station Progress Display

Keyboard Input Component

Fire Extinguisher Handler Component

Score System

HoverBox Component

MainGameActions Create Docket Triggers

End Day Display Component

Cutscene Area

Docket

Docket Line Display

Docket Meal Display

Main Game Order Button Display

Order Actions

Recipe

Ticket Details Component

BackstoryCutscene Test Plan

BackstoryCutsceneDisplay Test Plan

Test Plan for Tutorial

Keybinds

Keybinds Test Plan

Test Plan for MainGameOrderTicketDisplay

Test Plan for MainGameOrderBtnDisplay

Test Plan for Docket

Test Plan for DocketLineDisplay

Test Plan for OrderActions

Ticket Details

Test plan for RandomComboService

Test plan for LoanUpgrade

Test plan for UpgradesDisplay

Test plan for RageUpgrade

Test plan for SpeedBoostUpgrade

Test plan for DancePartyUpgrade

Test plan for ExtortionUpgrade

Troubleshooting

MacOS Setup Guide

Clone this wiki locally