* remove else condition

* remove else condition

* spring retry introduction

* remove else condition

* remove spring retry, format code
This commit is contained in:
Tuan
2016-12-02 05:46:56 +07:00
committed by Zeger Hendrikse
parent 5750a3a064
commit 6df8e9000e
3 changed files with 11 additions and 10 deletions
@@ -4,10 +4,10 @@ public class Account {
int balance = 20;
public boolean withdraw(int amount) {
if (balance - amount > 0) {
balance = balance - amount;
return true;
} else
if (balance < amount) {
return false;
}
balance = balance - amount;
return true;
}
}
@@ -16,12 +16,11 @@ public aspect AccountAspect {
}
boolean around(int amount, Account account) : callWithDraw(amount, account) {
if (account.balance - amount >= MIN_BALANCE)
return proceed(amount, account);
else {
if (account.balance < amount) {
logger.info("Withdrawal Rejected!");
return false;
}
return proceed(amount, account);
}
after(int amount, Account balance) : callWithDraw(amount, balance) {