1 package test.factory; 2 3 import org.testng.annotations.AfterClass; 4 import org.testng.annotations.BeforeClass; 5 import org.testng.annotations.Test; 6 7 public class FactoryOrderSampleTest { 8 9 int value; 10 11 public FactoryOrderSampleTest(int j) { 12 value = j; 13 log("classC constructor " + value); 14 } 15 16 private void log(String string) { 17 // System.out.println("[FactoryOrderSampleTest] " + string); 18 } 19 20 @BeforeClass(groups = { "s1ds" }) 21 public void setup() { 22 log("classC.BeforeClass " + value); 23 } 24 25 @Test(groups = { "s1ds" }) 26 public void methodC1() throws Exception { 27 // Thread.sleep(1000); 28 log("classC.methodC1 " + value); 29 } 30 31 @AfterClass(groups = { "s1ds" }) 32 public void cleanup() { 33 log("classC.AfterClass " + value); 34 } 35 36 @Override 37 public String toString() { 38 return "[FactoryOrderSampleTest " + value + "]"; 39 } 40 41 public int getValue() { 42 return value; 43 } 44 }