junit.extensions
Class ExceptionTestCase

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--junit.extensions.ExceptionTestCase

public class ExceptionTestCase
extends TestCase

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
ExceptionTestCase(java.lang.String name, java.lang.Class exception)
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, name, run, run, runBare, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, fail, fail
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExceptionTestCase

public ExceptionTestCase(java.lang.String name,
                         java.lang.Class exception)
Parameters:
name - java.lang.String
exception - java.lang.Class