junit.extensions
Class ExceptionTestCase
- Test
public class ExceptionTestCase
A TestCase that expects an Exception of class fExpected to be thrown.
The other way to check that an expected exception is thrown is:
try {
shouldThrow();
}
catch (SpecialException e) {
return;
}
fail("Expected SpecialException");
To use ExceptionTestCase, create a TestCase like:
new ExceptionTestCase("testShouldThrow", SpecialException.class);
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 , runTest , 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 |
ExceptionTestCase
public ExceptionTestCase(String name,
Class exception)
runTest
protected void runTest()
throws Throwable
Execute the test method expecting that an Exception of
class fExpected or one of its subclasses will be thrown
- runTest in interface TestCase