1 package test.dependent; 2 3 import org.testng.annotations.BeforeMethod; 4 import org.testng.annotations.Test; 5 6 public class SampleDependentConfigurationMethods { 7 private boolean m_create = false; 8 private boolean m_first = false; 9 10 @BeforeMethod 11 public void createInstance() { 12 m_create = true; 13 } 14 15 @BeforeMethod(dependsOnMethods = { "createInstance"}) 16 public void firstInvocation() { 17 assert m_create : "createInstance() was never called"; 18 m_first = true; 19 } 20 21 @Test 22 public void verifyDependents() { 23 assert m_create : "createInstance() was never called"; 24 assert m_first : "firstInvocation() was never called"; 25 } 26 } 27