1 package test.factory; 2 3 import org.testng.annotations.Test; 4 5 import java.util.HashMap; 6 import java.util.Map; 7 8 /** 9 * This class 10 * 11 * @author cbeust 12 */ 13 public class FactoryTest2 { 14 private static Map<Integer, Integer> m_numbers = new HashMap<>(); 15 private int m_number; 16 FactoryTest2()17 public FactoryTest2() { 18 throw new RuntimeException("Shouldn't be invoked"); 19 } 20 getNumbers()21 public static Map<Integer, Integer> getNumbers() { 22 return m_numbers; 23 } 24 FactoryTest2(int n)25 public FactoryTest2(int n) { 26 m_number = n; 27 } 28 29 @Test(groups = { "first" }) testInt()30 public void testInt() { 31 Integer n = m_number; 32 m_numbers.put(n, n); 33 } 34 35 @Override toString()36 public String toString() { 37 return "[FactoryTest2 " + m_number + "]"; 38 } 39 ppp(String s)40 private static void ppp(String s) { 41 System.out.println("[FactoryTest2] " + s); 42 } 43 44 } 45