1 package test.dataprovider; 2 3 import org.testng.Assert; 4 import org.testng.annotations.DataProvider; 5 import org.testng.annotations.Test; 6 7 8 /** 9 * This class/interface 10 */ 11 public class UnnamedDataProviderTest { 12 private boolean m_false = false; 13 private boolean m_true = false; 14 15 @Test(dataProvider = "unnamedDataProvider") doStuff(boolean t)16 public void doStuff(boolean t) { 17 if (t) { 18 m_true = true; 19 } 20 if (! t) { 21 m_false = true; 22 } 23 } 24 25 @Test(dependsOnMethods = {"doStuff"} ) verify()26 public void verify() { 27 Assert.assertTrue(m_true); 28 Assert.assertTrue(m_false); 29 } 30 31 @DataProvider unnamedDataProvider()32 public Object[][] unnamedDataProvider() { 33 return new Object[][] { 34 {Boolean.TRUE}, 35 {Boolean.FALSE} 36 }; 37 } 38 } 39