Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

5.3. Mocking Objects

Some programs rely heavily on the use of objects, eschewing global variables and functions for loosely-coupled, well-encapsulated, and strongly polymorphic designs. This kind of code can be easier to maintain and understand—and to test. Well-factored code that adheres to intelligent interfaces between objects makes it possible to reuse and substitute equivalent implementations—including testing components.

This lab demonstrates how to create and use mock objects to test the inputs and outputs of code.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial