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 ConfigurationTransformer implements IAnnotationTransformer2 { 13 14 @Override 15 public void transform(ITestAnnotation annotation, Class testClass, 16 Constructor testConstructor, Method testMethod) 17 { 18 } 19 20 @Override 21 public void transform(IConfigurationAnnotation annotation, Class testClass, 22 Constructor testConstructor, Method testMethod) 23 { 24 if (annotation.getBeforeTestMethod()) { 25 annotation.setEnabled(false); 26 } 27 } 28 29 @Override 30 public void transform(IDataProviderAnnotation annotation, Method testMethod) { 31 } 32 33 @Override 34 public void transform(IFactoryAnnotation annotation, Method testMethod) { 35 } 36 37 } 38