File tree Expand file tree Collapse file tree
src/main/java/com/baeldung/aspectj Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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>
113114 <useSystemClassLoader>true</useSystemClassLoader>
114115 <forkMode>always</forkMode>
115116 </configuration>
116- </plugin> -->
117+ </plugin>
118+ -->
117119 </plugins >
118120 </build >
119121
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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) {
You can’t perform that action at this time.
0 commit comments