O'Reilly logo

Test-Driven Development with Mockito by Sujoy Acharya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Leveraging the Mockito Framework in TDD

The classical TDD style uses real objects whenever possible and uses test doubles only when a real object and its behaviors are hard to understand. On the other hand, Mockist TDD style uses mock for all types of external dependencies.

The following are examples of external dependencies—to access google.com, a computer needs to connect to the Internet using a modem or broadband or dongle. Similarly, to perform a task if a piece of code needs to interact with another class or module or another application, this dependency is called external dependency. A payroll application may need an LDAP service to authenticate users or a Java class needs a data access object to save objects to a database.

In this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required