1 package test.methods; 2 3 import org.testng.annotations.Test; 4 5 /** 6 * This class is used to test invocation of methods 7 * 8 * @author cbeust 9 */ 10 public class SampleMethod1 { 11 private static boolean m_ok1 = false; 12 private static boolean m_ok2 = false; 13 private static boolean m_ok3 = true; 14 private static boolean m_ok4 = true; 15 reset()16 public static void reset() { 17 m_ok1 = false; 18 m_ok2 = false; 19 m_ok3 = true; 20 m_ok4 = true; 21 } 22 23 @Test(groups = { "sample1" }) shouldRun1()24 public void shouldRun1() { 25 m_ok1 = true; 26 } 27 28 @Test(groups = { "sample1" }) shouldRun2()29 public void shouldRun2() { 30 m_ok2 = true; 31 } 32 33 @Test shouldNotRun1()34 public void shouldNotRun1() { 35 m_ok3 = false; 36 } 37 38 @Test shouldNotRun2()39 public void shouldNotRun2() { 40 m_ok4 = false; 41 } 42 verify()43 public static void verify() { 44 assert m_ok1 && m_ok2 && m_ok3 && m_ok4 : 45 "All booleans should be true: " + m_ok1 + " " + m_ok2 46 + " " + m_ok3 + " " + m_ok4; 47 } ppp(String s)48 static private void ppp(String s) { 49 System.out.println("[SampleMethod1] " + s); 50 } 51 52 } 53