01: package test.expectedexceptions;
02:
03: import java.io.IOException;
04: import java.lang.reflect.Method;
05:
06: import org.testng.Assert;
07: import org.testng.annotations.AfterMethod;
08: import org.testng.annotations.DataProvider;
09: import org.testng.annotations.Test;
10: import org.xml.sax.SAXException;
11:
12: /**
13: * This class/interface
14: */
15: public class ParametersExceptionTest {
16: @Test(dataProvider="A")
17: public void testA(Exception err) {
18: System.out.println("testA");
19: }
20:
21: @DataProvider(name="A")
22: protected Object[][] dp() {
23: return new Object[][] { { new IOException(), new SAXException() } };
24: }
25:
26: @AfterMethod
27: protected void verify(Method method) {
28: Assert.assertTrue(false, "forced failure");
29: }
30: }
|