01: package test.dataprovider;
02:
03: import org.testng.Assert;
04:
05: public class Sample1Test {
06: private boolean m_ok1 = false;
07: private boolean m_ok2 = false;
08: private boolean m_ok3 = false;
09:
10: private static final String FN2 = "Anne Marie";
11: private static final Integer LN2 = new Integer(37);
12: private static final String FN1 = "Cedric";
13: private static final Integer LN1 = new Integer(36);
14: private static final String FN3 = "Alex";
15: private static final Integer LN3 = new Integer(30);
16:
17: /**
18: * @testng.data-provider name="test1"
19: */
20: public Object[][] createData() {
21: return new Object[][] { new Object[] { FN1, LN1 },
22: new Object[] { FN2, LN2 }, new Object[] { FN3, LN3 } };
23: }
24:
25: /**
26: * @testng.test dataProvider="test1"
27: */
28: public void verifyNames(String firstName, Integer age) {
29: if (firstName.equals(FN1) && age.equals(LN1)) {
30: m_ok1 = true;
31: }
32: if (firstName.equals(FN2) && age.equals(LN2)) {
33: m_ok2 = true;
34: }
35: if (firstName.equals(FN3) && age.equals(LN3)) {
36: m_ok3 = true;
37: }
38: }
39:
40: /**
41: * @testng.test dependsOnMethods = "verifyNames"
42: */
43: public void verifyCount() {
44: Assert.assertTrue(m_ok1 && m_ok2 && m_ok3);
45: }
46: }
|