01: package test.morten;
02:
03: import java.util.HashMap;
04:
05: import org.testng.annotations.*;
06:
07: public class SampleTest {
08: private int capacity = 10;
09: private float loadFactor = 0.3f;
10:
11: public class SampleTestTestFactory {
12: public SampleTestTestFactory() {
13: } // CTR necessary ?
14:
15: @Factory
16: public Object[] createInstances() {
17: return new SampleTest[] { new SampleTest(1, 0.1f),
18: new SampleTest(10, 0.5f), };
19: }
20: };
21:
22: public SampleTest() {
23:
24: }
25:
26: public SampleTest(int capacity, float loadFactor) {
27: System.out.println("CREATING TEST WITH " + capacity);
28: this .capacity = capacity;
29: this .loadFactor = loadFactor;
30: }
31:
32: @Test
33: public void testPut() {
34: HashMap hashTable = new HashMap(capacity, loadFactor);
35: // ...
36: }
37: }
|