JUnit contains about 75 named classes plus a number of inner classes and interfaces. It is organized into packages, as shown in Figure 6-1.
Figure 6-1. The JUnit packages and their import dependencies
The package junit.framework represents the core functionality, and the foundation on which unit tests are built. Much of the rest of the code is the relatively complex Swing, AWT, and text user interface (UI) packages, the package junit.samples (containing unit test examples), and the package junit.tests (containing JUnit's own unit tests). JUnit's developers "eat their own dog food" by providing a complete set of unit tests for all of its functionality.
The class architecture for the package junit.framework is shown in Figure 6-2.
Figure 6-2. Class architecture of the package junit.framework
The architecture of junit.framework follows the generic xUnit architectural model described in Chapter 3. In particular, notice a key architectural element, the interface Test , which is implemented by the classes TestCase and TestSuite . The abstract class TestCase is the parent of all unit test classes.
As described in Chapter 3, the key classes used when building unit tests are TestCase , TestSuite , and the TestRunner s. Appendix B is a detailed class reference for the junit.framework package.