Package junit.extensions
Class ExceptionTestCase
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
junit.extensions.ExceptionTestCase
- All Implemented Interfaces:
Test
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);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
runTest()
Execute the test method expecting that an Exception of class fExpected or one of its subclasses will be thrownMethods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, setName, setUp, tearDown, toString
Methods inherited from class junit.framework.Assert
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