org.easetech.easytest.interceptor
Interface MethodIntercepter
- All Known Implementing Classes:
- DefaultMethodIntercepter
public interface MethodIntercepter
Interface that provides the users with the ability to intercept
methods on class instances that are marked with Intercept annotations.
The user can provide the implementation of this interface as attribute to the Intercept annotation.
Note: If you are using DataDrivenTestRunner, then CGLib is being used to intercept method invocation behind the scene.
Look at InternalInterceptor class for more detail.
If you are using SpringTestRunner from the easytest-spring module,
then Spring AOP is being used to intercept method invocation behind the scene.You can look at SpringInternalIntercepter class
in the easytest-spring module for more detail.
- Author:
- Anuj Kumar
intercept
Object intercept(Method methodToIntercept,
Object targetInstance,
Object[] methodArgs)
throws Throwable
- Intercept the method invocation on the target class.
To be used for providing before and after advice when a given method is executed.
- Parameters:
methodToIntercept - the method to intercepttargetInstance - the target instance on which to call the methodmethodArgs - the arguments to the method
- Returns:
- object
- Throws:
Throwable - if any exception occurs
Copyright © 2013. All Rights Reserved.