01: package test.annotationtransformer;
02:
03: import java.lang.reflect.Constructor;
04: import java.lang.reflect.Method;
05:
06: import org.testng.internal.annotations.IAnnotationTransformer;
07: import org.testng.internal.annotations.ITest;
08:
09: public class MyTransformer implements IAnnotationTransformer {
10:
11: public void transform(ITest annotation, Class testClass,
12: Constructor testConstructor, Method testMethod) {
13: if (testMethod != null) {
14: String name = testMethod.getName();
15: if ("three".equals(name)) {
16: annotation.setInvocationCount(3);
17: } else if ("four".equals(name)) {
18: annotation.setInvocationCount(4);
19: } else if ("five".equals(name)) {
20: annotation.setInvocationCount(5);
21: }
22: }
23: }
24:
25: private void ppp(String string) {
26: System.out.println("[MyTransformer] " + string);
27: }
28:
29: }
|