~ubuntu-branches/ubuntu/utopic/testng/utopic

« back to all changes in this revision

Viewing changes to test/v4/src/test/ParameterConstructorTest.java

  • Committer: Bazaar Package Importer
  • Author(s): Marcus Better
  • Date: 2009-05-04 10:47:43 UTC
  • Revision ID: james.westby@ubuntu.com-20090504104743-1gbwsis9q1fh3aaj
Tags: upstream-5.9+dfsg
ImportĀ upstreamĀ versionĀ 5.9+dfsg

Show diffs side-by-side

added added

removed removed

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