liveBook · Manning

Chapter 15: Unit testing in Spring apps

What you will learn in chapter 15 of Spring Start Here, Second Edition

The chapter introduction defines tests, distinguishes unit from integration tests, and explains why testing protects an app’s capabilities over time.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduction defines tests, distinguishes unit from integration tests, and explains why testing protects an app’s capabilities over time.

Key terms: test, unit tests, integration tests, tests, existing capabilities, documentation, business value

15.1 Writing correctly implemented tests

This section explains why automated tests matter and how to organize tests around the different ways a method should behave.

Key terms: regression testing, tests, continuous integration (CI), build process, CI tool, test scenario, test method, test class, app’s requirements, credit limit

15.2 Implementing unit tests in Spring apps

This section shows how to unit-test Spring application logic in isolation by controlling dependencies and checking successful, exceptional, and returned-value outcomes.

Key terms: unit test, isolated, dependencies, Spring-based tests, assumptions, call/execution, validations, happy flow, arrange, act, and assert, AccountRepository

15.3 Questions

This section offers self-check questions about testing concepts, with answers in Appendix A.

15.4 Summary

Summarizes why tests matter, how unit and integration tests differ, why mocks are used, and the three parts of a test.

Where this is used later

Concepts explained in this chapter

← Chapter 14: Implementing data persistence with Spring Data Chapter 16: Implementing integration tests for Spring apps →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.