Skip to content

Commit 6df8e90

Browse files
nguyenminhtuanfitzhendrikse
authored andcommitted
* remove else condition * remove else condition * spring retry introduction * remove else condition * remove spring retry, format code
1 parent 5750a3a commit 6df8e90

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

‎aspectj/pom.xml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,14 @@
9898
<execution>
9999
<goals>
100100
<goal>compile</goal>
101-
<goal>test-compile</goal>
101+
<goal>test-compile</goal>
102102
</goals>
103103
</execution>
104104
</executions>
105105
</plugin>
106106

107-
<!-- <plugin>
107+
<!--
108+
<plugin>
108109
<groupId>org.apache.maven.plugins</groupId>
109110
<artifactId>maven-surefire-plugin</artifactId>
110111
<version>2.10</version>
@@ -113,7 +114,8 @@
113114
<useSystemClassLoader>true</useSystemClassLoader>
114115
<forkMode>always</forkMode>
115116
</configuration>
116-
</plugin> -->
117+
</plugin>
118+
-->
117119
</plugins>
118120
</build>
119121

‎aspectj/src/main/java/com/baeldung/aspectj/Account.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ public class Account {
44
int balance = 20;
55

66
public boolean withdraw(int amount) {
7-
if (balance - amount > 0) {
8-
balance = balance - amount;
9-
return true;
10-
} else
7+
if (balance < amount) {
118
return false;
9+
}
10+
balance = balance - amount;
11+
return true;
1212
}
1313
}

‎aspectj/src/main/java/com/baeldung/aspectj/AccountAspect.aj‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ public aspect AccountAspect {
1616
}
1717

1818
boolean around(int amount, Account account) : callWithDraw(amount, account) {
19-
if (account.balance - amount >= MIN_BALANCE)
20-
return proceed(amount, account);
21-
else {
19+
if (account.balance < amount) {
2220
logger.info("Withdrawal Rejected!");
2321
return false;
2422
}
23+
return proceed(amount, account);
2524
}
2625

2726
after(int amount, Account balance) : callWithDraw(amount, balance) {

0 commit comments

Comments
 (0)