01: package test.annotationtransformer;
02:
03: import org.testng.Assert;
04: import org.testng.TestNG;
05:
06: import test.annotationtransformer.MyTransformer;
07:
08: public class AnnotationTransformerSampleTest {
09:
10: private int m_two = 0;
11: private int m_five = 0;
12: private int m_three = 0;
13: private int m_four = 0;
14:
15: /**
16: * @testng.test invocationCount = 2
17: */
18: public void two() {
19: m_two++;
20: ppp("Should be invoked 2 times");
21: }
22:
23: /**
24: * @testng.test invocationCount = 5
25: */
26: public void four() {
27: m_four++;
28: ppp("Should be invoked 4 times");
29: }
30:
31: /**
32: * @testng.test invocationCount = 5
33: */
34: public void three() {
35: m_three++;
36: ppp("Should be invoked 3 times");
37: }
38:
39: /**
40: * @testng.test
41: */
42: public void five() {
43: m_five++;
44: ppp("Should be invoked 5 times");
45: }
46:
47: private void ppp(String string) {
48: if (false) {
49: System.out.println("[AnnotationTransformerSampleTest] "
50: + string);
51: }
52: }
53:
54: /**
55: * @testng.test dependsOnMethods = "two three four five"
56: */
57: public void verify() {
58: Assert.assertEquals(m_two, 2);
59: Assert.assertEquals(m_three, 3);
60: Assert.assertEquals(m_four, 4);
61: Assert.assertEquals(m_five, 5);
62:
63: }
64:
65: public static void main(String[] argv) {
66: TestNG tng = new TestNG();
67: tng.setVerbose(0);
68: tng.setAnnotations(TestNG.JAVADOC_ANNOTATION_TYPE);
69: tng.setSourcePath("test-14/src");
70: tng.setAnnotationTransformer(new MyTransformer());
71: tng
72: .setTestClasses(new Class[] { AnnotationTransformerSampleTest.class });
73:
74: tng.run();
75: }
76:
77: }
|