PR (#843)
* remove else condition * remove else condition * spring retry introduction * remove else condition * remove spring retry, format code
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user