Book Image

SPRING COOKBOOK

Book Image

SPRING COOKBOOK

Overview of this book

Table of Contents (19 chapters)
Spring Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Introduction


We often skip unit testing because we don't know how to do it or we believe that testing web applications is difficult. In fact, unit testing is easy and Spring makes web application testing effortless.

In this chapter, you will first learn how to write unit tests using JUnit, TestNG, and Mockito. Then, we will use Spring context, dependency injection, and transactions in our tests. Finally, we will test Spring controller methods using only a few lines of code.