JsUnit |
A TestCase that expects an exception of class mClass to be thrown. More...
Public Member Functions | |
void | ExceptionTestCase (String name, Function clazz) |
Constructor. More... | |
Public Member Functions inherited from TestCase | |
void | TestCase (String name) |
Constructs a test case with the given name. More... | |
void | tearDown () |
Clear up the environment of the fixture. More... | |
void | setUp () |
Set up the environment of the fixture. More... | |
Public Member Functions inherited from Assert | |
void | Assert () |
Public Attributes | |
Function | mClass |
Save the class. More... | |
Public Attributes inherited from TestCase | |
int | mName |
Additional Inherited Members | |
Protected Member Functions inherited from Test | |
virtual void | Test () |
virtual String | getName () |
Retrieves the name of the test. More... | |
virtual Test | findTest (String testName) |
Search a test by name. More... | |
virtual void | setName (String testName) |
Sets the name of the test. More... | |
virtual Number | countTestCases () |
Counts the number of test cases that will be run by this test. More... | |
virtual TestResult | run (TestResult result) |
Runs the test. More... | |
A TestCase that expects an exception of class mClass to be thrown.
The other way to check that an expected exception is thrown is:
try { this.shouldThrow(); } catch (ex) { if (ex instanceof SpecialException) return; else throw ex; } this.fail("Expected SpecialException");
To use ExceptionTestCase, create a TestCase like:
new ExceptionTestCase("testShouldThrow", SpecialException);
Constructor.
The constructor is initialized with the name of the test and the expected class to be thrown.
name | The name of the test case. |
clazz | The class to be thrown. |
Function ExceptionTestCase::mClass |
Save the class.
JsUnit © 1999, 2000, 2001, 2002, 2003, 2006, 2007 by Jörg Schaible
|
Generated on Wed Apr 15 2015 02:33:07 for JsUnit by doxygen 1.8.5
|