Implement the BankAccount class to pass the beginner tasks.
- Implement
deposit(double amount)with guard clauses for invalid deposits (zero/negative). - Implement
withdraw(double amount)with guard clauses (no overdraft, no negative withdrawal). - Implement
getBalance()to return the current balance. - Test edge cases:
- Deposit 0
- Withdraw more than balance
- Negative deposit/withdrawal
Compile and run tests with Gradle:
./gradlew test # macOS/Linux
gradlew.bat test # Windows