TestClassAnnotationTest.java :  » Testing » testng » test » factory » Java Open Source

Java Open Source » Testing » testng 
testng » test » factory » TestClassAnnotationTest.java
package test.factory;

import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;

/**
 * Make sure that @Factory methods are not counted as @Test in the
 * presence of a class-scoped @Test annotation.
 * 
 * Created on Mar 30, 2006
 * @author <a href="mailto:cedric@beust.com">Cedric Beust</a>
 */
@Test
public class TestClassAnnotationTest {
  
  private int m_count;
  
  @Factory
  public Object[] createFixture() {
    ppp("FACTORY");
    m_count++;
    return new Object[] { new Object[] { new Object() }};
  }

  public void testOne() {
    ppp("TESTONE");
    m_count++;
  }
  
  @AfterClass
  public void verify() {
    ppp("VERIFY");
    Assert.assertEquals(m_count, 2);    
  }
  
  private static void ppp(String s) {
    if (false) {
      System.err.println("[FactoryTest] " + s);
    }
  }

}
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.