BAEL-4071 - Get advised method info in Spring AOP

Fixing identation
This commit is contained in:
Sallo Szrajbman 2020-12-19 12:58:00 +00:00
parent 73af581e18
commit 0c926e7441
6 changed files with 94 additions and 95 deletions

View File

@ -23,9 +23,6 @@ public class Account {
@Override @Override
public String toString() { public String toString() {
return "Account{" + return "Account{" + "accountNumber='" + accountNumber + '\'' + ", balance=" + balance + '}';
"accountNumber='" + accountNumber + '\'' +
", balance=" + balance +
'}';
} }
} }

View File

@ -28,13 +28,16 @@ public class BankAccountAspect {
// Method args // Method args
System.out.println("Method args names:"); System.out.println("Method args names:");
Arrays.stream(signature.getParameterNames()).forEach(s -> System.out.println("arg name: " + s)); Arrays.stream(signature.getParameterNames())
.forEach(s -> System.out.println("arg name: " + s));
System.out.println("Method args types:"); System.out.println("Method args types:");
Arrays.stream(signature.getParameterTypes()).forEach(s -> System.out.println("arg type: " + s)); Arrays.stream(signature.getParameterTypes())
.forEach(s -> System.out.println("arg type: " + s));
System.out.println("Method args values:"); System.out.println("Method args values:");
Arrays.stream(joinPoint.getArgs()).forEach(o -> System.out.println("arg value: " + o.toString())); Arrays.stream(joinPoint.getArgs())
.forEach(o -> System.out.println("arg value: " + o.toString()));
// Additional Information // Additional Information
System.out.println("returning type: " + signature.getReturnType()); System.out.println("returning type: " + signature.getReturnType());
@ -50,4 +53,3 @@ public class BankAccountAspect {
} }
} }

View File

@ -26,5 +26,4 @@ public class BankAccountService {
return RandomUtils.nextDouble(); return RandomUtils.nextDouble();
} }
} }

View File

@ -31,7 +31,8 @@ class BankAccountServiceIntegrationTest {
@Test @Test
void withdrawWhenLimitReached() { void withdrawWhenLimitReached() {
Assertions.assertThatExceptionOfType(WithdrawLimitException.class).isThrownBy(() -> bankAccountService.withdraw(account, 600.0)); Assertions.assertThatExceptionOfType(WithdrawLimitException.class)
.isThrownBy(() -> bankAccountService.withdraw(account, 600.0));
assertTrue(account.getBalance() == 2000.0); assertTrue(account.getBalance() == 2000.0);
} }