public class ExceptionTestCase extends TestCase
try { shouldThrow(); } catch (SpecialException e) { return; } fail("Expected SpecialException");To use ExceptionTestCase, create a TestCase like:
new ExceptionTestCase("testShouldThrow", SpecialException.class);
Constructor and Description |
---|
ExceptionTestCase(java.lang.String name,
java.lang.Class exception) |
Modifier and Type | Method and Description |
---|---|
protected void |
runTest()
Execute the test method expecting that an Exception of
class fExpected or one of its subclasses will be thrown
|
countTestCases, createResult, getName, run, run, runBare, setName, setUp, tearDown, toString
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame