1 package test.annotationtransformer; 2 3 import org.testng.annotations.BeforeClass; 4 import org.testng.annotations.BeforeMethod; 5 import org.testng.annotations.Test; 6 7 public class ConfigurationSampleTest { 8 private static String m_before = "uninitialized"; 9 10 @BeforeClass 11 public void beforeClass() { 12 m_before = "correct"; 13 } 14 15 @BeforeMethod(enabled = false) 16 public void testingEnabledOnConfiguration() { 17 m_before = "this method is not enabled, we should not be here"; 18 } 19 20 // will be disabled by the configuration transformer 21 @BeforeMethod 22 public void beforeMethod() { 23 m_before = "incorrect"; 24 } 25 26 @Test 27 public void f() {} 28 29 public static String getBefore() { 30 return m_before; 31 } 32 } 33