1package test.annotationtransformer;
2
3import org.testng.IAnnotationTransformer3;
4import org.testng.annotations.IConfigurationAnnotation;
5import org.testng.annotations.IDataProviderAnnotation;
6import org.testng.annotations.IFactoryAnnotation;
7import org.testng.annotations.IListenersAnnotation;
8import org.testng.annotations.ITestAnnotation;
9
10import java.lang.reflect.Constructor;
11import java.lang.reflect.Method;
12
13public class MyListenerTransformer implements IAnnotationTransformer3 {
14
15  @Override
16  public void transform(IListenersAnnotation annotation, Class testClass) {
17    annotation.setValue(new Class[]{MySuiteListener2.class});
18  }
19
20  @Override
21  public void transform(IConfigurationAnnotation annotation, Class testClass,
22                        Constructor testConstructor, Method testMethod) {}
23
24  @Override
25  public void transform(IDataProviderAnnotation annotation, Method method) {}
26
27  @Override
28  public void transform(IFactoryAnnotation annotation, Method method) {}
29
30  @Override
31  public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor,
32                        Method testMethod) {}
33}
34