appendix-b
                    Appendix B. Brief JUnit 3.8 tutorial
 
![]()  |  
    The name of the class should indicate that it’s a test—for example, have the class name start with Test. | 
![]()  |  
    We extend from JUnit’s TestCase class. | 
![]()  |  
    The instance variables set up in the setUp() method represent the common fixture for the test methods. | 
![]()  |  
    We can prepare a known state for the test by overriding the protected setUp() method. | 
![]()  |  
    If using Java 5, it’s good to add the @Override annotation to setUp() and tearDown() to avoid typos. | 
![]()  |  
    We can clean up after our test by overriding the protected tearDown() method. | 
![]()  |  
    All public void methods starting with test are considered test cases by the JUnit 3.8 TestRunner. | 
![]()  |  
    Test methods can declare any exceptions—JUnit catches them. | 
![]()  |  
    We can declare any number of helper methods as long as they don’t look like test methods. | 
![]()  |  
    Extending TestCase gives us, among other things, a bunch of assertion methods such as assertEquals(). | 









