1 package test.alwaysrun; 2 3 import org.testng.annotations.AfterClass; 4 import org.testng.annotations.BeforeClass; 5 6 public class AlwaysRunAfter2 { 7 8 private static boolean m_success = true; 9 10 @BeforeClass setUpShouldFail()11 public void setUpShouldFail() { 12 throw new RuntimeException("Failing in setUp"); 13 } 14 15 // Should not be run 16 @AfterClass tearDown()17 public void tearDown() { 18 m_success = false; 19 } 20 success()21 static public boolean success() { 22 return m_success; 23 } 24 } 25