1 package test;
2 
3 import static org.testng.Assert.assertEquals;
4 import static org.testng.Assert.assertTrue;
5 
6 import org.testng.annotations.Parameters;
7 import org.testng.annotations.Test;
8 
9 /**
10  * Test parameters passed to constructors
11  *
12  * @author cbeust
13  */
14 public class ParameterConstructorTest {
15   private String m_string = null;
16   private int m_int = -1;
17   private boolean m_boolean = false;
18   private byte m_byte = -1;
19   private char m_char = 0;
20   private double m_double = 0.0;
21   private float m_float = 0.0f;
22   private long m_long = 0;
23   private short m_short = 0;
24 
25   @Parameters({ "string", "int", "boolean", "byte", "char", "double",
26       "float", "long", "short"  })
ParameterConstructorTest(String s, int i, boolean bo, byte b, char c, double d, float f, long l, short sh)27   public ParameterConstructorTest(String s, int i, boolean bo, byte b, char c,
28       double d, float f, long l, short sh)
29   {
30     m_string = s;
31     m_int = i;
32     m_boolean = bo;
33     m_byte = b;
34     m_char = c;
35     m_double = d;
36     m_float = f;
37     m_long = l;
38     m_short = sh;
39   }
40 
41   @Test
verify()42   public void verify() {
43     assertEquals("Cedric", m_string);
44     assertEquals(42, m_int);
45     assertTrue(m_boolean);
46     assertEquals(43, m_byte);
47     assertEquals('c', m_char);
48     assertEquals(44.0, m_double, 0.1);
49     assertEquals(45.0f, m_float, 0.1);
50     assertEquals(46, m_long);
51     assertEquals(47, m_short);
52   }
53 
54 }
55