Home | History | Annotate | Download | only in thread
      1 package test.thread;
      2 
      3 import org.testng.annotations.DataProvider;
      4 import org.testng.annotations.Factory;
      5 import org.testng.annotations.Test;
      6 
      7 public class ParallelWithFactorySampleTest extends BaseSequentialSample {
      8   private int m_n;
      9 
     10   @DataProvider
     11   public static Object[][] dp() {
     12     return new Object[][] {
     13         new Object[] { 42 },
     14         new Object[] { 43 }
     15     };
     16   }
     17 
     18   @Factory(dataProvider = "dp")
     19   public ParallelWithFactorySampleTest(int n) {
     20     m_n = n;
     21   }
     22 
     23 
     24   protected int getN() {
     25     return m_n;
     26   }
     27 
     28 
     29   @Test
     30   public void f1() {
     31     addId("f1 " + getN(), Thread.currentThread().getId());
     32   }
     33 
     34   @Test
     35   public void f2() {
     36     addId("f2", Thread.currentThread().getId());
     37   }
     38 }
     39