MyTransformer.java :  » Testing » testng » test » annotationtransformer » Java Open Source

Java Open Source » Testing » testng 
testng » test » annotationtransformer » MyTransformer.java
package test.annotationtransformer;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

import org.testng.internal.annotations.IAnnotationTransformer;
import org.testng.internal.annotations.ITest;

public class MyTransformer implements IAnnotationTransformer {

  public void transform(ITest annotation, Class testClass, 
      Constructor testConstructor, Method testMethod) 
  {
    if (testMethod != null) {
      String name = testMethod.getName();
      if ("three".equals(name)) {
        annotation.setInvocationCount(3);
      }
      else if ("four".equals(name)) {
        annotation.setInvocationCount(4);
      }
      else if ("five".equals(name)) {
        annotation.setInvocationCount(5);
      }
    }
  }

  private void ppp(String string) {
    System.out.println("[MyTransformer] " + string);
  }
  


}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.