8 Testing with mock objects

This chapter covers

  • Introducing and demonstrating mock objects
  • Executing different refactorings with the help of mock objects
  • Practicing on an HTTP connection sample application
  • Working with and comparing the EasyMock, JMock, and Mockito frameworks

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

Unit testing each method in isolation from other methods or the environment is certainly a nice goal. How do you perform this task? You saw in chapter 7 that the stubbing technique lets you unit test portions of code by isolating them from the environment ...

Get JUnit in Action, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.