Home | History | Annotate | Download | only in factory
      1 package test.factory;
      2 
      3 import org.testng.Assert;
      4 import org.testng.annotations.AfterClass;
      5 import org.testng.annotations.Factory;
      6 import org.testng.annotations.Test;
      7 
      8 /**
      9  * 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 (at) 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 }
     45