01: package test.expectedexceptions;
02:
03: /**
04: * This class tests @ExpectedExceptions
05: *
06: * @author cbeust
07: */
08: public class SampleExceptions {
09:
10: /**
11: * @testng.test
12: * @testng.expected-exceptions value="java.lang.NumberFormatException"
13: */
14: public void shouldPass() {
15: throw new java.lang.NumberFormatException();
16: }
17:
18: /**
19: * @testng.test
20: * @testng.expected-exceptions value="java.lang.NumberFormatException"
21: */
22: public void shouldFail1() {
23: throw new RuntimeException();
24: }
25:
26: /**
27: * @testng.test
28: * @testng.expected-exceptions value="java.lang.NumberFormatException"
29: */
30: public void shouldFail2() {
31: }
32:
33: }
|