1 package test.dataprovider; 2 3 import org.testng.Assert; 4 import org.testng.annotations.DataProvider; 5 import org.testng.annotations.Test; 6 7 public class BooleanTest { 8 private boolean m_false = false; 9 private boolean m_true = false; 10 11 @Test(dataProvider = "allBooleans") doStuff(boolean t)12 public void doStuff(boolean t) { 13 if (t) { 14 m_true = true; 15 } 16 if (! t) { 17 m_false = true; 18 } 19 } 20 21 @Test(dependsOnMethods = {"doStuff"} ) verify()22 public void verify() { 23 Assert.assertTrue(m_true); 24 Assert.assertTrue(m_false); 25 } 26 ppp(String string)27 private void ppp(String string) { 28 System.out.println("[BooleanTest] " + string); 29 } 30 31 @DataProvider(name = "allBooleans") createData()32 public Object[][] createData() { 33 return new Object[][] { 34 new Object[] { true }, 35 new Object[] { false }, 36 }; 37 } 38 39 } 40