@ -129,15 +129,12 @@ public class MethodInvocationProceedingJoinPointTests {
final Object raw = new TestBean ( ) ;
final Object raw = new TestBean ( ) ;
ProxyFactory pf = new ProxyFactory ( raw ) ;
ProxyFactory pf = new ProxyFactory ( raw ) ;
pf . addAdvisor ( ExposeInvocationInterceptor . ADVISOR ) ;
pf . addAdvisor ( ExposeInvocationInterceptor . ADVISOR ) ;
pf . addAdvice ( new MethodBeforeAdvice ( ) {
pf . addAdvice ( ( MethodBeforeAdvice ) ( method , args , target ) - > {
@Override
SourceLocation sloc = AbstractAspectJAdvice . currentJoinPoint ( ) . getSourceLocation ( ) ;
public void before ( Method method , Object [ ] args , @Nullable Object target ) throws Throwable {
assertThat ( AbstractAspectJAdvice . currentJoinPoint ( ) . getSourceLocation ( ) ) . as ( "Same source location must be returned on subsequent requests" ) . isEqualTo ( sloc ) ;
SourceLocation sloc = AbstractAspectJAdvice . currentJoinPoint ( ) . getSourceLocation ( ) ;
assertThat ( sloc . getWithinType ( ) ) . isEqualTo ( TestBean . class ) ;
assertThat ( AbstractAspectJAdvice . currentJoinPoint ( ) . getSourceLocation ( ) ) . as ( "Same source location must be returned on subsequent requests" ) . isEqualTo ( sloc ) ;
assertThatExceptionOfType ( UnsupportedOperationException . class ) . isThrownBy ( sloc : : getLine ) ;
assertThat ( sloc . getWithinType ( ) ) . isEqualTo ( TestBean . class ) ;
assertThatExceptionOfType ( UnsupportedOperationException . class ) . isThrownBy ( sloc : : getFileName ) ;
assertThatExceptionOfType ( UnsupportedOperationException . class ) . isThrownBy ( sloc : : getLine ) ;
assertThatExceptionOfType ( UnsupportedOperationException . class ) . isThrownBy ( sloc : : getFileName ) ;
}
} ) ;
} ) ;
ITestBean itb = ( ITestBean ) pf . getProxy ( ) ;
ITestBean itb = ( ITestBean ) pf . getProxy ( ) ;
// Any call will do
// Any call will do
@ -149,15 +146,12 @@ public class MethodInvocationProceedingJoinPointTests {
final Object raw = new TestBean ( ) ;
final Object raw = new TestBean ( ) ;
ProxyFactory pf = new ProxyFactory ( raw ) ;
ProxyFactory pf = new ProxyFactory ( raw ) ;
pf . addAdvisor ( ExposeInvocationInterceptor . ADVISOR ) ;
pf . addAdvisor ( ExposeInvocationInterceptor . ADVISOR ) ;
pf . addAdvice ( new MethodBeforeAdvice ( ) {
pf . addAdvice ( ( MethodBeforeAdvice ) ( method , args , target ) - > {
@Override
StaticPart staticPart = AbstractAspectJAdvice . currentJoinPoint ( ) . getStaticPart ( ) ;
public void before ( Method method , Object [ ] args , @Nullable Object target ) throws Throwable {
assertThat ( AbstractAspectJAdvice . currentJoinPoint ( ) . getStaticPart ( ) ) . as ( "Same static part must be returned on subsequent requests" ) . isEqualTo ( staticPart ) ;
StaticPart staticPart = AbstractAspectJAdvice . currentJoinPoint ( ) . getStaticPart ( ) ;
assertThat ( staticPart . getKind ( ) ) . isEqualTo ( ProceedingJoinPoint . METHOD_EXECUTION ) ;
assertThat ( AbstractAspectJAdvice . currentJoinPoint ( ) . getStaticPart ( ) ) . as ( "Same static part must be returned on subsequent requests" ) . isEqualTo ( staticPart ) ;
assertThat ( staticPart . getSignature ( ) ) . isSameAs ( AbstractAspectJAdvice . currentJoinPoint ( ) . getSignature ( ) ) ;
assertThat ( staticPart . getKind ( ) ) . isEqualTo ( ProceedingJoinPoint . METHOD_EXECUTION ) ;
assertThat ( staticPart . getSourceLocation ( ) ) . isEqualTo ( AbstractAspectJAdvice . currentJoinPoint ( ) . getSourceLocation ( ) ) ;
assertThat ( staticPart . getSignature ( ) ) . isSameAs ( AbstractAspectJAdvice . currentJoinPoint ( ) . getSignature ( ) ) ;
assertThat ( staticPart . getSourceLocation ( ) ) . isEqualTo ( AbstractAspectJAdvice . currentJoinPoint ( ) . getSourceLocation ( ) ) ;
}
} ) ;
} ) ;
ITestBean itb = ( ITestBean ) pf . getProxy ( ) ;
ITestBean itb = ( ITestBean ) pf . getProxy ( ) ;
// Any call will do
// Any call will do
@ -169,22 +163,19 @@ public class MethodInvocationProceedingJoinPointTests {
final Object raw = new TestBean ( ) ;
final Object raw = new TestBean ( ) ;
ProxyFactory pf = new ProxyFactory ( raw ) ;
ProxyFactory pf = new ProxyFactory ( raw ) ;
pf . addAdvisor ( ExposeInvocationInterceptor . ADVISOR ) ;
pf . addAdvisor ( ExposeInvocationInterceptor . ADVISOR ) ;
pf . addAdvice ( new MethodBeforeAdvice ( ) {
pf . addAdvice ( ( MethodBeforeAdvice ) ( method , args , target ) - > {
@Override
// makeEncSJP, although meant for computing the enclosing join point,
public void before ( Method method , Object [ ] args , @Nullable Object target ) throws Throwable {
// it serves our purpose here
// makeEncSJP, although meant for computing the enclosing join point,
StaticPart aspectJVersionJp = Factory . makeEncSJP ( method ) ;
// it serves our purpose here
JoinPoint jp = AbstractAspectJAdvice . currentJoinPoint ( ) ;
JoinPoint . StaticPart aspectJVersionJp = Factory . makeEncSJP ( method ) ;
JoinPoint jp = AbstractAspectJAdvice . currentJoinPoint ( ) ;
assertThat ( jp . getSignature ( ) . toLongString ( ) ) . isEqualTo ( aspectJVersionJp . getSignature ( ) . toLongString ( ) ) ;
assertThat ( jp . getSignature ( ) . toShortString ( ) ) . isEqualTo ( aspectJVersionJp . getSignature ( ) . toShortString ( ) ) ;
assertThat ( jp . getSignature ( ) . toLongString ( ) ) . isEqualTo ( aspectJVersionJp . getSignature ( ) . toLongString ( ) ) ;
assertThat ( jp . getSignature ( ) . toString ( ) ) . isEqualTo ( aspectJVersionJp . getSignature ( ) . toString ( ) ) ;
assertThat ( jp . getSignature ( ) . toShortString ( ) ) . isEqualTo ( aspectJVersionJp . getSignature ( ) . toShortString ( ) ) ;
assertThat ( jp . getSignature ( ) . toString ( ) ) . isEqualTo ( aspectJVersionJp . getSignature ( ) . toString ( ) ) ;
assertThat ( jp . toLongString ( ) ) . isEqualTo ( aspectJVersionJp . toLongString ( ) ) ;
assertThat ( jp . toShortString ( ) ) . isEqualTo ( aspectJVersionJp . toShortString ( ) ) ;
assertThat ( jp . toLongString ( ) ) . isEqualTo ( aspectJVersionJp . toLongString ( ) ) ;
assertThat ( jp . toString ( ) ) . isEqualTo ( aspectJVersionJp . toString ( ) ) ;
assertThat ( jp . toShortString ( ) ) . isEqualTo ( aspectJVersionJp . toShortString ( ) ) ;
assertThat ( jp . toString ( ) ) . isEqualTo ( aspectJVersionJp . toString ( ) ) ;
}
} ) ;
} ) ;
ITestBean itb = ( ITestBean ) pf . getProxy ( ) ;
ITestBean itb = ( ITestBean ) pf . getProxy ( ) ;
itb . getAge ( ) ;
itb . getAge ( ) ;