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