PR (#843)
* remove else condition * remove else condition * spring retry introduction * remove else condition * remove spring retry, format code
This commit is contained in:
parent
5750a3a064
commit
6df8e9000e
|
@ -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>
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue