Dummy objects are passed to the class under test but never used. This is common in business applications where you need to fill a long list of parameters, but the test exercises only a few of them. Think of a unit test for a Customer
class. Maybe this class depends on several other classes like Address
, Email
, and so on. Maybe a specific test case A wants to exercise a behavior, and this behavior does not care which Address
this Customer
has. In this case, a tester can set up a dummy Address
object and pass it to the Customer
class.
Leave a Reply