In this chapter we describe how to test a single class. The techniques we describe in this chapter will be applied in later chapters when we discuss testing object interactions and testing classes in an inheritance hierarchy. For this discussion, we assume the code for a class has been written and needs to be tested. Our primary focus is on classes whose instances do not collaborate extensively with any other instance. We will use the Velocity and PuckSupply classes from Brickles to illustrate. We will address the testing of more complex classes in the next two chapters. |