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
dp()11   public static Object[][] dp() {
12     return new Object[][] {
13         new Object[] { 42 },
14         new Object[] { 43 }
15     };
16   }
17 
18   @Factory(dataProvider = "dp")
ParallelWithFactorySampleTest(int n)19   public ParallelWithFactorySampleTest(int n) {
20     m_n = n;
21   }
22 
23 
getN()24   protected int getN() {
25     return m_n;
26   }
27 
28 
29   @Test
f1()30   public void f1() {
31     addId("f1 " + getN(), Thread.currentThread().getId());
32   }
33 
34   @Test
f2()35   public void f2() {
36     addId("f2", Thread.currentThread().getId());
37   }
38 }
39