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
  • PrintPrint
Share this Page URL
Help

Chapter 7. Testing with mock objects > Unit testing with mock objects

7.2. Unit testing with mock objects

In this section, we present an application and a test using mock objects. Imagine a simple use case where you want to be able to make a bank transfer from one account to another (figure 7.1 and listings 7.1 and 7.2).

Figure 7.1. In this simple bank account example, we use a mock object to test an account transfer method.



  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint