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 FailingDataProvider { 12 @DataProvider 13 public Object[][] throwsExpectedException() { 14 throw new RuntimeException("expected exception from @DP"); 15 } 16 17 @Test(dataProvider="throwsExpectedException") 18 public void dpThrowingException() { 19 Assert.fail("Method should never get invoked"); 20 } 21 } 22