01: package test.factory;
02:
03: import org.testng.Assert;
04: import org.testng.annotations.AfterClass;
05: import org.testng.annotations.Factory;
06: import org.testng.annotations.Test;
07:
08: /**
09: * Make sure that @Factory methods are not counted as @Test in the
10: * presence of a class-scoped @Test annotation.
11: *
12: * Created on Mar 30, 2006
13: * @author <a href="mailto:cedric@beust.com">Cedric Beust</a>
14: */
15: @Test
16: public class TestClassAnnotationTest {
17:
18: private int m_count;
19:
20: @Factory
21: public Object[] createFixture() {
22: ppp("FACTORY");
23: m_count++;
24: return new Object[] { new Object[] { new Object() } };
25: }
26:
27: public void testOne() {
28: ppp("TESTONE");
29: m_count++;
30: }
31:
32: @AfterClass
33: public void verify() {
34: ppp("VERIFY");
35: Assert.assertEquals(m_count, 2);
36: }
37:
38: private static void ppp(String s) {
39: if (false) {
40: System.err.println("[FactoryTest] " + s);
41: }
42: }
43:
44: }
|