16 Testing Spring applications

This chapter covers

  • Understanding dependency injection
  • Building and testing a Spring application
  • Using SpringExtension for JUnit Jupiter
  • Testing Spring application features with JUnit 5

“Dependency Injection” is a 25-dollar term for a 5-cent concept.

--James Shore

Spring is a lightweight--but at the same time flexible and universal--open source set of frameworks for creating Java applications. It is not dedicated to any particular layer, which means it can be used at the level of any layer of a Java application. This chapter will focus on the basis of Spring: the dependency injection (or inversion of control) pattern; and how to test core Spring applications with the help of JUnit 5.

16.1 Introducing the Spring ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.