1 package junit.extensions;
2
3 import junit.framework.*;
4
5 /**
6 * A TestCase that expects an Exception of class fExpected to be thrown.
7 * The other way to check that an expected exception is thrown is:
8 * <pre>
9 * try {
10 * shouldThrow();
11 * }
12 * catch (SpecialException e) {
13 * return;
14 * }
15 * fail("Expected SpecialException");
16 * </pre>
17 *
18 * To use ExceptionTestCase, create a TestCase like:
19 * <pre>
20 * new ExceptionTestCase("testShouldThrow", SpecialException.class);
21 * </pre>
22 */
23 public class ExceptionTestCase extends TestCase {
24 Class fExpected;
25
26 public ExceptionTestCase(String name, Class exception) {
|