Build 1.0_r1(from source)

junit.extensions
Class ExceptionTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by junit.extensions.ExceptionTestCase
All Implemented Interfaces:
Test

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);
 


Field Summary
(package private)  Class fExpected
           
 
Constructor Summary
ExceptionTestCase(String name, Class exception)
           
 
Method Summary
protected  void runTest()
          Execute the test method expecting that an Exception of class fExpected or one of its subclasses will be thrown
 
Methods 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fExpected

Class fExpected
Constructor Detail

ExceptionTestCase

public ExceptionTestCase(String name,
                         Class exception)
Method Detail

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

Overrides:
runTest in class TestCase
Throws:
Throwable - if any exception is thrown

Build 1.0_r1(from source)

Please submit a feedback, bug or feature