Cover by Gary Gregory, Vincent Massol, Felipe Leme, Petar Tahchiev

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Chapter 7. Testing with mock objects

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

Rich Cook

This chapter covers

  • Introducing and demonstrating mock objects
  • Performing different refactorings
  • Practicing on the HTTP connection sample application
  • Introducing the EasyMock and the JMock libraries

Unit testing each method in isolation from the other methods or the environment is certainly a nice goal. How do you perform this feat? You saw in chapter 6 how the stubbing technique lets you unit test portions of code by isolating them from the environment (for example, by stubbing a web ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required