As an existing bank customer with an account, I want to withdraw money from my account, so that I can use my funds for expenses.
Acceptance Criteria
Scenario 1: Successful withdrawal
Given the user has an active bank account with sufficient balance,
When they provide the correct account ID and a valid withdrawal amount,
Then the balance of the account is decreased by the withdrawn amount.
Scenario 2: Unsuccessful withdrawal due to insufficient funds
Given the user has an active bank account but an insufficient balance,
When they attempt to withdraw an amount greater than the balance,
Then the system does not process the withdrawal and an error message is displayed.
Scenario 3: Unsuccessful withdrawal due to invalid account ID
Given the user provides an invalid or non-existent account ID,
When they attempt to withdraw money,
Then the system does not process the withdrawal and an error message is displayed.
Scenario 4: Unsuccessful withdrawal due to invalid amount
Given the user has an active bank account,
When they attempt to withdraw a zero or negative amount,
Then the system does not process the withdrawal and an error message is displayed.
Tasks
- Add a method for withdrawing money from an account in the Bank class.
- Ensure the method validates the account ID, withdrawal amount, and account balance before processing.
- Create unit tests to verify all acceptance criteria.
As an existing bank customer with an account, I want to withdraw money from my account, so that I can use my funds for expenses.
Acceptance Criteria
Scenario 1: Successful withdrawal
Given the user has an active bank account with sufficient balance,
When they provide the correct account ID and a valid withdrawal amount,
Then the balance of the account is decreased by the withdrawn amount.
Scenario 2: Unsuccessful withdrawal due to insufficient funds
Given the user has an active bank account but an insufficient balance,
When they attempt to withdraw an amount greater than the balance,
Then the system does not process the withdrawal and an error message is displayed.
Scenario 3: Unsuccessful withdrawal due to invalid account ID
Given the user provides an invalid or non-existent account ID,
When they attempt to withdraw money,
Then the system does not process the withdrawal and an error message is displayed.
Scenario 4: Unsuccessful withdrawal due to invalid amount
Given the user has an active bank account,
When they attempt to withdraw a zero or negative amount,
Then the system does not process the withdrawal and an error message is displayed.
Tasks