| package test.morten; |
| |
| import java.util.HashMap; |
| |
| import org.testng.annotations.*; |
| |
| public class SampleTest { |
| private int capacity = 10; |
| private float loadFactor = 0.3f; |
| |
| public class SampleTestTestFactory { |
| public SampleTestTestFactory() {} // CTR necessary ? |
| @Factory public Object[] createInstances() { |
| return new SampleTest[] { |
| new SampleTest(1, 0.1f), |
| new SampleTest(10, 0.5f), |
| }; |
| } |
| }; |
| |
| public SampleTest() { |
| |
| } |
| |
| public SampleTest(int capacity, float loadFactor) |
| { |
| System.out.println("CREATING TEST WITH " + capacity); |
| this.capacity=capacity; |
| this.loadFactor=loadFactor; |
| } |
| |
| @Test public void testPut() |
| { |
| HashMap hashTable = new HashMap(capacity, loadFactor); |
| // ... |
| } |
| } |