1 package test.listeners;
2 
3 import org.testng.IMethodInstance;
4 import org.testng.IMethodInterceptor;
5 import org.testng.ITestContext;
6 
7 import java.util.List;
8 
9 public class MyMethodInterceptor implements IMethodInterceptor {
10 
11     private int count = 0;
12 
13     @Override
intercept(List<IMethodInstance> methods, ITestContext context)14     public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) {
15         count++;
16         return methods;
17     }
18 
getCount()19     public int getCount() {
20         return count;
21     }
22 }
23