1 package test.invokedmethodlistener; 2 3 import org.testng.annotations.AfterClass; 4 import org.testng.annotations.AfterMethod; 5 import org.testng.annotations.AfterSuite; 6 import org.testng.annotations.AfterTest; 7 import org.testng.annotations.BeforeClass; 8 import org.testng.annotations.BeforeMethod; 9 import org.testng.annotations.BeforeSuite; 10 import org.testng.annotations.BeforeTest; 11 import org.testng.annotations.Test; 12 13 public class Base { 14 private boolean m_fail; 15 Base(boolean fail)16 public Base(boolean fail) { 17 m_fail = fail; 18 } 19 20 @BeforeMethod beforeMethod()21 public void beforeMethod() { 22 } 23 24 @AfterMethod afterMethod()25 public void afterMethod() {} 26 27 @BeforeTest beforeTest()28 public void beforeTest() {} 29 30 @AfterTest afterTest()31 public void afterTest() {} 32 33 @BeforeClass beforeClass()34 public void beforeClass() {} 35 36 @AfterClass afterClass()37 public void afterClass() {} 38 39 @BeforeSuite beforeSuite()40 public void beforeSuite() {} 41 42 @AfterSuite afterSuite()43 public void afterSuite() { 44 if (m_fail) { 45 throw new RuntimeException("After Suite FAILING"); 46 } 47 } 48 49 @Test a()50 public void a() { 51 if (m_fail) { 52 throw new IllegalArgumentException("Test Method FAILING"); 53 } 54 } 55 56 } 57