1 package test.dependent;
2 
3 import org.testng.annotations.AfterClass;
4 import org.testng.annotations.Parameters;
5 import org.testng.annotations.Test;
6 
7 
8 /**
9  * This class tests overloaded dependent methods
10  *
11  * @author Cedric Beust, Aug 19, 2004
12  *
13  */
14 public class SampleDependentMethods3 {
15   private boolean m_oneA = false;
16   private boolean m_oneB = false;
17   private boolean m_secondA = false;
18 
19   @Test
one()20   public void one() {
21 //    ppp("oneA");
22     assert ! m_secondA : "secondA shouldn't have been run yet";
23     m_oneA = true;
24   }
25 
26   @Parameters({ "foo" })
27   @Test
one(String s)28   public void one(String s) {
29 //    ppp("oneB");
30     assert ! m_secondA : "secondA shouldn't have been run yet";
31     assert "Cedric".equals(s) : "Expected parameter value Cedric but got " + s;
32     m_oneB = true;
33   }
34 
35   @Test(dependsOnMethods = { "one" } )
secondA()36   public void secondA() {
37 //    ppp("secondA");
38     assert m_oneA : "oneA wasn't run";
39     assert m_oneB : "oneB wasn't run";
40     assert ! m_secondA : "secondA shouldn't have been run yet";
41     m_secondA = true;
42   }
43 
44   @AfterClass
tearDown()45   public void tearDown() {
46     assert m_oneA : "oneA wasn't run";
47     assert m_oneB : "oneB wasn't run";
48     assert m_secondA : "secondA wasn't run";
49   }
50 
ppp(String s)51   public static void ppp(String s) {
52     System.out.println("[SampleDependentMethods] " + s);
53   }
54 }