1 package test.factory; 2 3 import org.testng.Assert; 4 import org.testng.TestListenerAdapter; 5 import org.testng.TestNG; 6 import org.testng.annotations.Test; 7 8 public class FactoryWithDataProviderTest { 9 10 /** 11 * Verify that a factory can receive a data provider 12 */ 13 @Test verifyDataProvider()14 public void verifyDataProvider() { 15 TestNG tng = new TestNG(); 16 tng.setVerbose(0); 17 tng.setTestClasses(new Class[] { FactoryWithDataProvider.class }); 18 TestListenerAdapter tla = new TestListenerAdapter(); 19 tng.addListener(tla); 20 tng.run(); 21 22 Assert.assertEquals(tla.getPassedTests().size(), 4); 23 24 } 25 ppp(String s)26 private static void ppp(String s) { 27 System.out.println("[FactoryWithDataProviderTest] " + s); 28 } 29 } 30