Skip to Main Content
JUnit in Action, Third Edition
book

JUnit in Action, Third Edition

by Catalin Tudose
January 2021
Intermediate to advanced content levelIntermediate to advanced
560 pages
15h 13m
English
Manning Publications
Content preview from JUnit in Action, Third Edition

7 Coarse-grained testing with stubs

This chapter covers

  • Testing with stubs
  • Using an embedded server in place of a real web server
  • Implementing unit tests of an HTTP connection with stubs

And yet it moves.

--Galileo Galilei

As you develop your applications, you will find that the code you want to test depends on other classes, which themselves depend on other classes, which then depend on the environment (figure 7.1). You might be developing an application that uses Hibernate to access a database, a Java EE application (one that relies on a Java EE container for security, persistence, and other services), an application that accesses a filesystem, or an application that connects to some resource by using HTTP or another protocol.

Figure 7.1 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Test-Driven Java Development, Second Edition - Second Edition

Test-Driven Java Development, Second Edition - Second Edition

Viktor Farcic, Alex Garcia

Publisher Resources

ISBN: 9781617297045Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentPurchase Link