1 package test.access; 2 3 import org.testng.Assert; 4 import org.testng.annotations.BeforeMethod; 5 import org.testng.annotations.Test; 6 7 /** 8 * Test that private and protected @Configuration methods are run 9 * 10 * @author cbeust 11 */ 12 public class PrivateAccessConfigurationMethods 13 extends BasePrivateAccessConfigurationMethods 14 { 15 private boolean m_private = false; 16 private boolean m_default = false; 17 private boolean m_protected = false; 18 private boolean m_public = false; 19 20 @BeforeMethod privateConfBeforeMethod()21 private void privateConfBeforeMethod() { 22 m_private = true; 23 } 24 25 @BeforeMethod defaultConfBeforeMethod()26 void defaultConfBeforeMethod() { 27 m_default = true; 28 } 29 30 @BeforeMethod protectedConfBeforeMethod()31 protected void protectedConfBeforeMethod() { 32 m_protected = true; 33 } 34 35 @BeforeMethod publicConfBeforeMethod()36 public void publicConfBeforeMethod() { 37 m_public = true; 38 } 39 40 @Test allAccessModifiersConfiguration()41 public void allAccessModifiersConfiguration() { 42 Assert.assertTrue(m_private, "private @Configuration should have been run"); 43 Assert.assertTrue(m_default, "default @Configuration should have been run"); 44 Assert.assertTrue(m_protected, "protected @Configuration should have been run"); 45 Assert.assertTrue(m_public, "public @Configuration should have been run"); 46 47 Assert.assertTrue(m_baseProtected, "protected base @Configuration should have been run"); 48 Assert.assertTrue(m_baseDefault, "default base @Configuration should have been run"); 49 Assert.assertTrue(m_basePrivate, "private base @Configuration should not have been run"); 50 51 } 52 } 53