* 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

View File

@ -98,13 +98,14 @@
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
@ -113,7 +114,8 @@
<useSystemClassLoader>true</useSystemClassLoader>
<forkMode>always</forkMode>
</configuration>
</plugin> -->
</plugin>
-->
</plugins>
</build>

View File

@ -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;
}
}

View File

@ -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) {