01: package test.dependent;
02:
03: import org.testng.Assert;
04: import org.testng.annotations.BeforeMethod;
05: import org.testng.annotations.Test;
06:
07: /**
08: * This class/interface
09: */
10: public class DependsOnProtectedMethodTest {
11: private boolean m_before1 = false;
12: private boolean m_before2 = false;
13:
14: @BeforeMethod(dependsOnMethods={"before2"})
15: protected void before() {
16: m_before1 = true;
17: }
18:
19: @BeforeMethod
20: protected void before2() {
21: m_before2 = true;
22: }
23:
24: @Test
25: public void verifyBeforeInvocations() {
26: Assert
27: .assertTrue(m_before1 && m_before2,
28: "Protected dependent @BeforeMethods should have been invoked");
29: }
30: }
|