1 package test.morten; 2 3 import org.testng.annotations.Factory; 4 import org.testng.annotations.Test; 5 6 public class SampleTest { 7 private int capacity = 10; 8 private float loadFactor = 0.3f; 9 10 public class SampleTestTestFactory { SampleTestTestFactory()11 public SampleTestTestFactory() {} // CTR necessary ? createInstances()12 @Factory public Object[] createInstances() { 13 return new SampleTest[] { 14 new SampleTest(1, 0.1f), 15 new SampleTest(10, 0.5f), 16 }; 17 } 18 }; 19 SampleTest()20 public SampleTest() { 21 22 } 23 SampleTest(int capacity, float loadFactor)24 public SampleTest(int capacity, float loadFactor) 25 { 26 System.out.println("CREATING TEST WITH " + capacity); 27 this.capacity=capacity; 28 this.loadFactor=loadFactor; 29 } 30 testPut()31 @Test public void testPut() 32 { 33 //FIXME: This test does nothing 34 //HashMap hashTable = new HashMap(capacity, loadFactor); 35 // ... 36 } 37 } 38