|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A "marker" interface, which declares no methods, but indicates that this class knows how to perform unit-tests on itself.
Classes which implement _Testable must define (or inherit) a static method _test_class() with the following signature:
static void _test_class() throws Exception
This method should run all unit tests necessary to test the entire class, and raise an Exception on failure. If the method returns normally, this indicates that the class passed all of its unit tests.
If this class extends another class which also implements _Testable, then _test_class() should, in general, call the superclass's _test_class() method before doing anything else. Exceptions to this rule are extremely rare.
Note that, because this method is meant to be used only during unit-testing, implementations are not required to leave the class (i.e. its static members) in the same state that they found it, regardless of whether the tests passed or failed. However, a successful test should clean up any additional persistent resources (such as database entries) that may have been created during the course of the test.
If the test fails, and an exception is raised, then something is wrong with the class and all of this class's contractual obligations (as specified in its API) should be considered null and void. Including this one.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |